/* 
  JAI Commodities - Design System 
  Theme: Premium Agricultural Trade (Deep Greens, Golds, Clean Dark/Light Modes)
*/

:root {
    /* 
       --- COLOR PALETTE --- 
       Using HSL for easy variations
    */

    /* Primary: Deep Jungle Green (Trust, Growth, Stability) */
    --primary-h: 155;
    --primary-s: 45%;
    --primary-l: 18%;
    --color-primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
    --color-primary-light: hsl(var(--primary-h), var(--primary-s), 30%);
    --color-primary-dark: hsl(var(--primary-h), var(--primary-s), 12%);

    /* Secondary/Accent: Vibrant Gold (Wealth, Commodities, Value) */
    --accent-h: 38;
    --accent-s: 92%;
    --accent-l: 55%;
    --color-accent: hsl(var(--accent-h), var(--accent-s), var(--accent-l));
    --color-accent-hover: hsl(var(--accent-h), var(--accent-s), 45%);

    /* Functional Colors */
    --color-success: hsl(145, 63%, 42%);
    --color-warning: hsl(40, 90%, 60%);
    --color-danger: hsl(0, 75%, 55%);
    --color-info: hsl(200, 90%, 45%);

    /* Backgrounds & Surfaces (Light Mode Default) */
    --bg-body: hsl(150, 20%, 98%);
    /* Very subtle tint */
    --bg-surface: hsl(0, 0%, 100%);
    --bg-surface-glass: rgba(255, 255, 255, 0.7);
    --border-color: hsl(150, 10%, 90%);

    /* Typography */
    --text-main: hsl(155, 20%, 10%);
    --text-muted: hsl(155, 10%, 40%);
    --text-inverted: hsl(0, 0%, 100%);

    /* Spacing & Layout */
    --container-width: 1200px;
    --header-height: 80px;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 50px;

    /* Shadows (Premium Feel) */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 20, 10, 0.08);
    --shadow-lg: 0 16px 48px rgba(0, 20, 10, 0.12);
    --shadow-glow: 0 0 20px rgba(220, 180, 50, 0.3);

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Dark Mode Support (Prefer-color-scheme or class toggle) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-body: hsl(155, 30%, 5%);
        --bg-surface: hsl(155, 25%, 10%);
        --bg-surface-glass: rgba(10, 20, 15, 0.7);
        --border-color: hsl(155, 20%, 18%);

        --text-main: hsl(155, 10%, 95%);
        --text-muted: hsl(155, 10%, 60%);

        --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
        --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    }
}

/* --- RESET & BASE --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- TYPOGRAPHY --- */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

h1 {
    font-size: 3.5rem;
}

h2 {
    font-size: 2.5rem;
}

h3 {
    font-size: 1.5rem;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-fast);
}

/* --- UTILITIES & LAYOUT --- */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.glass {
    background: var(--bg-surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
}

.text-gradient {
    background: linear-gradient(135deg, var(--color-primary-light), var(--color-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- COMPONENTS --- */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: var(--transition-fast);
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(4, 71, 40, 0.2);
}

.btn-primary:hover {
    background-color: var(--color-primary-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(4, 71, 40, 0.3);
}

.btn-ghost {
    background: transparent;
    color: var(--text-main);
}

.btn-ghost:hover {
    background: rgba(0, 0, 0, 0.05);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.btn-outline:hover {
    background: var(--color-primary);
    color: white;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.05rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-body);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5%;
    z-index: 1000;
    transition: var(--transition-smooth);
}

.navbar .logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: var(--color-primary);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    font-weight: 500;
    opacity: 0.7;
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    opacity: 1;
    color: var(--color-primary);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--color-accent);
    border-radius: 2px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Hero Section */
.hero {
    padding: calc(var(--header-height) + 4rem) 5% 4rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    min-height: 90vh;
    background: radial-gradient(circle at top right, rgba(235, 196, 68, 0.15), transparent 60%);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(4, 71, 40, 0.1);
    color: var(--color-primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(4, 71, 40, 0.1);
}

.dot {
    width: 8px;
    height: 8px;
    background: red;
    border-radius: 50%;
    background-color: var(--color-danger);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 50, 50, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(220, 50, 50, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(220, 50, 50, 0);
    }
}

.divider {
    width: 1px;
    height: 40px;
    background: var(--border-color);
}

.hero-content h1 {
    margin-bottom: 1.5rem;
}

.hero-content p {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    max-width: 90%;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    margin-bottom: 4rem;
}

.stats-row {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.hero-visual {
    position: relative;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Floating Cards Animation */
.floating-card {
    position: absolute;
    padding: 1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-surface);
    width: 260px;
    animation: float 6s ease-in-out infinite;
    z-index: 2;
}

.card-1 {
    top: 20%;
    right: 10%;
    animation-delay: 0s;
}

.card-2 {
    bottom: 25%;
    left: 5%;
    animation-delay: 2s;
}

.card-icon {
    width: 48px;
    height: 48px;
    background: var(--color-primary-light);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

.card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.card-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-primary);
}

/* Globe Placeholder */
.globe-container {
    position: relative;
    width: 100%;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-ring {
    width: 400px;
    height: 400px;
    border-radius: 50%;
    border: 1px solid var(--color-primary-light);
    /* Fallback */
    background: url('https://images.unsplash.com/photo-1451187580459-43490279c0fa?q=80&w=1080&auto=format&fit=crop') center/cover no-repeat;
    opacity: 0.9;
    box-shadow: 0 0 50px rgba(4, 71, 40, 0.2);
    /* mask-image or clip-path could be added here for globe shape */
    clip-path: circle(50% at 50% 50%);
}

/* Dashboard Section */
.dashboard-section {
    padding: 4rem 5%;
    background: var(--bg-surface);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    margin: 0;
}

.ticker-wrap {
    background: var(--color-primary);
    color: white;
    padding: 0.75rem 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 10;
}

.ticker-title {
    padding: 0 2rem;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
    background: var(--color-primary);
    z-index: 2;
}

.ticker-item {
    display: inline-flex;
    align-items: center;
    padding: 0 2rem;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.ticker {
    flex: 1;
    overflow: hidden;
}

.ticker-track {
    display: flex;
    width: max-content;
    animation: ticker-scroll 30s linear infinite;
}

.ticker-wrap:hover .ticker-track {
    animation-play-state: paused;
}

@keyframes ticker-scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-33.33%);
    }
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 0;
    /* Reset padding to allow header flow */
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.25rem;
    margin: 0;
}

.table-container {
    padding: 0 2rem 2rem;
    overflow-x: auto;
}

.side-card .demand-list {
    padding: 0 2rem;
}

.side-card .update-info {
    padding: 0 2rem 2rem;
}

.price-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.price-table th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 2px solid var(--border-color);
}

.price-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.trend-up,
.text-success {
    color: var(--color-success);
}

.trend-down,
.text-danger {
    color: var(--color-danger);
}

/* Demand/Insights List */
.demand-list {
    list-style: none;
    margin-top: 1.5rem;
}

.demand-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.demand-item:last-child {
    border-bottom: none;
}

.demand-info h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.demand-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.demand-badge {
    background: rgba(235, 196, 68, 0.1);
    color: var(--color-accent-hover);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
}

.update-info {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    /* Adjust alignment */
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid transparent;
    transition: var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* Features */
.features-section {
    padding: 6rem 5%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    padding: 2.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-accent);
}

.feature-icon {
    font-size: 2.5rem;
    color: var(--color-accent);
    margin-bottom: 1.5rem;
}

/* AI Panel */
.ai-panel {
    margin-top: 2rem;
    border-radius: var(--radius-md);
    background: #0d1210;
    /* Dark Terminal-like background */
    color: #00ff9d;
    /* Matrix Green */
    border: 1px solid #1a2e24;
    overflow: hidden;
    font-family: 'Courier New', Courier, monospace;
}

.ai-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid #1a2e24;
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ai-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #00ff9d;
}

.pulse-green {
    box-shadow: 0 0 0 0 rgba(0, 255, 157, 0.7);
    animation: ai-pulse 2s infinite;
}

@keyframes ai-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 255, 157, 0.7);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(0, 255, 157, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 255, 157, 0);
    }
}

.ai-title {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.ai-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.ai-logs {
    padding: 1rem 1.5rem;
    height: 150px;
    overflow-y: auto;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column-reverse;
    /* New logs at bottom visually, or handle via JS */
}

.log-entry {
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(0, 255, 157, 0.1);
    display: flex;
    gap: 1rem;
}

.log-entry.breaking .msg {
    color: #ff3333;
    font-weight: bold;
    text-transform: uppercase;
    text-shadow: 0 0 5px rgba(255, 50, 50, 0.4);
}

.log-entry.breaking .time {
    color: #ff3333;
}

/* Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--color-primary);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--color-primary);
}

input:checked+.slider:before {
    -webkit-transform: translateX(20px);
    -ms-transform: translateX(20px);
    transform: translateX(20px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Footer */
footer {
    padding: 4rem 5%;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
}

/* Modal & Login */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal {
    background: var(--bg-surface);
    width: 100%;
    max-width: 400px;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.modal-overlay.hidden .modal {
    transform: translateY(20px);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.modal-header h2 {
    font-size: 1.5rem;
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--color-danger);
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.9rem;
}

.input-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-body);
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-main);
    transition: border-color 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(4, 71, 40, 0.1);
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.text-center {
    text-align: center;
}

.text-sm {
    font-size: 0.85rem;
}

.mt-4 {
    margin-top: 1rem;
}