/* =========================================================================
   LinkTrade Simple Mode — for low-literacy farmers
   Big buttons, picture icons, minimal text, high contrast
   Activated by adding class="simple-mode" to <body>
   ========================================================================= */

body.simple-mode {
    --lt-simple-tap: 56px;       /* minimum tap target */
    --lt-simple-font: 18px;      /* base font size */
    --lt-simple-heading: 26px;   /* heading size */
    --primary: var(--accent, #1f8d52); /* theme alias — layout defines --accent, not --primary */
    font-size: var(--lt-simple-font);
}

body.simple-mode h1 { font-size: var(--lt-simple-heading); }
body.simple-mode h2 { font-size: 22px; }
body.simple-mode h3 { font-size: 20px; }

/* Hide complex nav, show simple nav */
body.simple-mode .nav-group:not(.simple-nav-group),
body.simple-mode .nav-section {
    display: none !important;
}

/* Don't hide dropdowns that contain the simple toggle button */
body.simple-mode .dd {
    display: none !important;
}

/* Hide duplicate text links (Dashboard/Profile are already big buttons in the simple nav) */
body.simple-mode #navLinks > a.nav-priority,
body.simple-mode #navLinks > a[href="?r=profile"] {
    display: none !important;
}

/* Keep logout and the simple toggle visible */
body.simple-mode [data-simple-toggle],
body.simple-mode form[action*="logout"] {
    display: inline-block !important;
}

/* Profile lives in the simple nav */
body.simple-mode .simple-nav-item.active .icon { filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }

body.simple-mode .simple-nav {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

body.simple-mode .simple-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    min-height: var(--lt-simple-tap);
    padding: 10px 14px;
    border-radius: 14px;
    background: var(--card);
    border: 2px solid var(--line);
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    transition: transform .1s, background .15s;
}

body.simple-mode .simple-nav-item .icon {
    font-size: 28px;
    margin-bottom: 4px;
    line-height: 1;
}

body.simple-mode .simple-nav-item:active {
    transform: scale(0.95);
    background: var(--primary);
    color: white;
}

body.simple-mode .simple-nav-item.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Big action buttons in simple mode */
body.simple-mode .btn {
    min-height: var(--lt-simple-tap);
    font-size: 17px;
    font-weight: 700;
    border-radius: 14px;
    padding: 14px 20px;
}

body.simple-mode .btn-primary {
    min-height: 60px;
    font-size: 18px;
}

/* Simple mode dashboard cards — bigger, clearer */
body.simple-mode .dash-sidebar {
    display: none;
}

body.simple-mode .dash-main {
    grid-column: 1 / -1;
}

body.simple-mode .quick-action-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

body.simple-mode .quick-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    background: var(--card);
    border: 2px solid var(--line);
    border-radius: 18px;
    text-decoration: none;
    color: var(--text);
    padding: 16px;
    transition: transform .12s, box-shadow .15s;
}

body.simple-mode .quick-action-card:active {
    transform: scale(0.96);
}

body.simple-mode .quick-action-card .qa-icon {
    font-size: 42px;
    margin-bottom: 8px;
    line-height: 1;
}

body.simple-mode .quick-action-card .qa-label {
    font-size: 15px;
    font-weight: 700;
    text-align: center;
}

body.simple-mode .quick-action-card .qa-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

/* Simple mode forms — bigger inputs, fewer fields shown */
body.simple-mode input[type="text"],
body.simple-mode input[type="number"],
body.simple-mode input[type="tel"],
body.simple-mode input[type="password"],
body.simple-mode input[type="date"],
body.simple-mode input[type="datetime-local"],
body.simple-mode select,
body.simple-mode textarea {
    min-height: var(--lt-simple-tap);
    font-size: 18px;
    border-radius: 12px;
    border-width: 2px;
    padding: 14px;
}

body.simple-mode label {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
}

/* Hide non-essential elements in simple mode */
body.simple-mode .sidebar-section,
body.simple-mode .guide-item,
body.simple-mode .dash-sidebar-section,
body.simple-mode .lt-float,
body.simple-mode .advanced-only {
    display: none !important;
}

/* Simple mode summary cards — bigger numbers */
body.simple-mode .stat-card,
body.simple-mode .summary-card {
    min-height: 100px;
    padding: 20px;
}

body.simple-mode .stat-card .num,
body.simple-mode .summary-card .num {
    font-size: 32px;
}

body.simple-mode .stat-card .lbl,
body.simple-mode .summary-card .lbl {
    font-size: 14px;
}

/* Voice button — visible in simple mode */
.voice-btn {
    display: none;
}

body.simple-mode .voice-btn,
body.voice-enabled .voice-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #1f8d52;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 22px;
    flex-shrink: 0;
    transition: transform .12s, background .15s;
    margin-left: 8px;
}

body.simple-mode .voice-btn:active,
body.voice-enabled .voice-btn:active {
    transform: scale(0.92);
}

.voice-btn.recording {
    background: #ef4444;
    animation: voice-pulse 1s infinite;
}

@keyframes voice-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* Audio readback button */
.audio-btn {
    display: none;
}

body.simple-mode .audio-btn,
body.audio-enabled .audio-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #0891b2;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 20px;
    flex-shrink: 0;
    transition: transform .12s;
}

.audio-btn:active { transform: scale(0.92); }
.audio-btn.playing { background: #06b6d4; animation: audio-pulse 1s infinite; }

@keyframes audio-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Voice input wrapper — for forms */
.voice-input-wrap {
    display: flex;
    align-items: center;
    gap: 0;
}

.voice-input-wrap input {
    flex: 1;
    border-radius: 12px 0 0 12px !important;
}

.voice-input-wrap .voice-btn {
    border-radius: 0 12px 12px 0 !important;
    margin-left: 0;
    height: 100%;
    min-height: var(--lt-simple-tap);
    width: var(--lt-simple-tap);
}

/* Simple mode banner */
.simple-mode-banner {
    display: none;
    background: linear-gradient(135deg, #1f8d52, #4ade80);
    color: white;
    padding: 10px 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

body.simple-mode .simple-mode-banner {
    display: flex;
}

.simple-mode-banner .exit-btn {
    background: rgba(255,255,255,.25);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

/* Photo quick-add button */
.photo-quick-add {
    display: none;
}

body.simple-mode .photo-quick-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    border: 3px dashed var(--line);
    border-radius: 18px;
    background: var(--card);
    cursor: pointer;
    padding: 20px;
    transition: border-color .15s, background .15s;
    width: 100%;
    margin-bottom: 16px;
}

body.simple-mode .photo-quick-add:active {
    border-color: var(--primary);
    background: #f0fdf4;
}

.photo-quick-add .pqa-icon {
    font-size: 42px;
    margin-bottom: 8px;
}

.photo-quick-add .pqa-label {
    font-size: 16px;
    font-weight: 700;
}

.photo-quick-add .pqa-sub {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

/* Big number display for prices in simple mode */
body.simple-mode .big-price {
    font-size: 36px;
    font-weight: 800;
    color: #1f8d52;
}

/* Simplified cards in simple mode — less density */
body.simple-mode .card {
    padding: 20px;
    border-radius: 16px;
}

body.simple-mode .rfq-card,
body.simple-mode .auc-card,
body.simple-mode .wh-card,
body.simple-mode .dir-card,
body.simple-mode .offer-card,
body.simple-mode .bid-card {
    min-height: 80px;
    padding: 18px;
}

/* Responsive: on phones the big-button nav is ALWAYS visible — no hamburger menu for farmers */
@media (max-width: 768px) {
    body.simple-mode .nav .links {
        display: flex !important;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        border-top: none;
        margin-top: 4px;
        padding-top: 4px;
    }
    body.simple-mode .mobile-nav-toggle,
    body.simple-mode .mobile-nav-close {
        display: none !important;
    }
    body.simple-mode .simple-nav {
        width: 100%;
        display: grid !important;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    body.simple-mode .simple-nav-item {
        min-width: 0;
        width: 100%;
        min-height: 72px;
        padding: 8px 4px;
        font-size: 13px;
    }
    body.simple-mode .simple-nav-item .icon {
        font-size: 30px;
    }
    body.simple-mode .nav .links form[action*="logout"],
    body.simple-mode .nav .links [data-simple-toggle] {
        flex: 1 1 45%;
    }
    body.simple-mode .nav .links form[action*="logout"] button {
        width: 100%;
    }
}

@media (max-width: 640px) {
    body.simple-mode .quick-action-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Reduced motion: disable voice/audio pulse */
@media (prefers-reduced-motion: reduce) {
    .voice-btn.recording,
    .audio-btn.playing {
        animation: none;
    }
}
