/* ═══════════════════════════════════════════
   DBT Fertilizer - Web Retailer Portal
   ═══════════════════════════════════════════ */

:root {
    --primary: #5D4037;
    --primary-dark: #3E2723;
    --primary-light: #8D6E63;
    --accent: #FF6F00;
    --success: #2E7D32;
    --danger: #C62828;
    --bg: #F5F5F5;
    --card: #FFFFFF;
    --text: #212121;
    --text-secondary: #757575;
    --border: #E0E0E0;
    --whatsapp: #25D366;
    --locked-bg: #1a1a2e;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ─── Mobile Block Screen ─── */
#mobile-block {
    display: none;
    position: fixed; inset: 0;
    background: var(--primary-dark);
    color: white;
    z-index: 99999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}
#mobile-block .icon { font-size: 64px; margin-bottom: 20px; }
#mobile-block h2 { font-size: 24px; margin-bottom: 12px; }
#mobile-block p { font-size: 16px; opacity: 0.8; max-width: 400px; }

/* ─── Screen Container ─── */
.screen {
    display: none;
    min-height: 100vh;
    animation: fadeIn 0.3s ease;
}
.screen.active { display: flex; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Navbar ─── */
.navbar {
    background: var(--primary);
    color: white;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: sticky; top: 0;
    z-index: 100;
}
.navbar .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
}
.navbar .brand img { height: 36px; border-radius: 6px; }
.navbar .user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}
.navbar .user-info .shop-name {
    opacity: 0.9;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.btn-logout {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }

/* ─── Language Screen ─── */
#screen-language {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
}
.lang-card {
    background: var(--card);
    color: var(--text);
    border-radius: 16px;
    padding: 48px 40px;
    width: 420px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
}
.lang-card .logo { width: 80px; margin-bottom: 16px; }
.lang-card h1 { font-size: 22px; color: var(--primary-dark); margin-bottom: 4px; }
.lang-card .subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 32px; }
.lang-card label { display: block; text-align: left; font-size: 14px; font-weight: 600; margin-bottom: 8px; }

/* ─── Registration Screen ─── */
#screen-register {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}
.register-card {
    background: var(--card);
    color: var(--text);
    border-radius: 16px;
    padding: 40px;
    width: 480px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.register-card h2 { font-size: 22px; color: var(--primary-dark); margin-bottom: 8px; text-align: center; }
.register-card .desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; text-align: center; }

/* ─── Login Screen ─── */
#screen-login {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}
.login-card {
    background: var(--card);
    color: var(--text);
    border-radius: 16px;
    padding: 40px;
    width: 480px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-card h2 { font-size: 22px; color: var(--primary-dark); margin-bottom: 8px; text-align: center; }
.login-card .desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; text-align: center; }

/* ─── GSTIN Screen ─── */
#screen-gstin {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}
.gstin-card {
    background: var(--card);
    color: var(--text);
    border-radius: 16px;
    padding: 40px;
    width: 480px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
}
.gstin-card h2 { font-size: 22px; color: var(--primary-dark); margin-bottom: 24px; }

/* ─── Dashboard Screen ─── */
#screen-dashboard {
    flex-direction: column;
    background: var(--bg);
}
.dashboard-content {
    max-width: 1100px;
    margin: 24px auto;
    padding: 0 24px;
    width: 100%;
}
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.info-card {
    background: var(--card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-left: 4px solid var(--primary);
}
.info-card .label { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.info-card .value { font-size: 16px; font-weight: 600; color: var(--text); word-break: break-all; }

.menu-section h3 {
    font-size: 18px; color: var(--primary-dark);
    margin-bottom: 16px; padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.menu-item {
    background: var(--card);
    border-radius: 10px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid var(--border);
    font-size: 14px;
    font-weight: 500;
}
.menu-item:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); border-color: var(--primary-light); }
.menu-item .icon { font-size: 24px; }

/* ─── Subscription Screen ─── */
#screen-subscription {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 40px;
}
.sub-header {
    background: var(--primary);
    color: white;
    padding: 40px;
    border-radius: 16px 16px 0 0;
    text-align: center;
    width: 500px;
    max-width: 90%;
}
.sub-header .lock-icon { font-size: 48px; margin-bottom: 12px; }
.sub-header h2 { font-size: 26px; margin-bottom: 4px; }
.sub-header p { opacity: 0.8; font-size: 14px; }
.sub-body {
    background: white;
    padding: 32px 40px;
    border-radius: 0 0 16px 16px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}
.sub-status { font-size: 16px; color: var(--primary); text-align: center; margin-bottom: 8px; }
.sub-expiry { font-size: 13px; color: var(--text-secondary); text-align: center; margin-bottom: 24px; }

.plan-card {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.plan-card:hover, .plan-card.selected { border-color: var(--primary); background: #FFF8E1; }
.plan-card h4 { font-size: 16px; margin-bottom: 4px; }
.plan-card .price { font-size: 22px; font-weight: 700; color: var(--primary); }
.plan-card .features { font-size: 13px; color: var(--text-secondary); margin-top: 8px; line-height: 1.6; }
.plan-card .badge { display: inline-block; background: var(--accent); color: white; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 4px; margin-left: 8px; }

/* ─── Locked Screen ─── */
#screen-locked {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--locked-bg);
    color: white;
}
.locked-content { text-align: center; }
.locked-content .lock-icon { font-size: 64px; margin-bottom: 16px; }
.locked-content h2 { font-size: 28px; margin-bottom: 16px; }
.locked-content .reason { font-size: 16px; opacity: 0.8; max-width: 400px; }

/* ─── Form Elements ─── */
select, input[type="text"], input[type="password"], input[type="number"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s;
    outline: none;
    background: white;
}
select:focus, input:focus { border-color: var(--primary); }
input::placeholder { color: #BDBDBD; }

.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover:not(:disabled) { background: #E65100; }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}
.btn-outline:hover:not(:disabled) { background: var(--primary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #1B5E20; }
.btn-skip {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    margin-top: 8px;
}
.btn-skip:hover { background: var(--bg); }
.btn-sm { padding: 8px 16px; font-size: 13px; width: auto; }

/* ─── WhatsApp FAB ─── */
.fab-whatsapp {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--whatsapp);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(37,211,102,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 1000;
}
.fab-whatsapp:hover { transform: scale(1.1); box-shadow: 0 6px 20px rgba(37,211,102,0.5); }
.fab-whatsapp svg { width: 28px; height: 28px; fill: white; }

/* ─── Device Info Bar ─── */
.device-bar {
    background: #FFF8E1;
    border: 1px solid #FFE082;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}
.device-bar .status-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--danger);
}
.device-bar .status-dot.connected { background: var(--success); }

/* ─── RD Service Status ─── */
.rd-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
}
.rd-status.scanning { background: #E3F2FD; color: #1565C0; }
.rd-status.connected { background: #E8F5E9; color: #2E7D32; }
.rd-status.error { background: #FFEBEE; color: #C62828; }
.rd-status .spinner {
    width: 16px; height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Consent Dialog ─── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}
.modal-overlay.active { display: flex; }
.modal {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal h3 { font-size: 20px; margin-bottom: 16px; color: var(--primary-dark); }
.modal p { font-size: 14px; line-height: 1.6; color: var(--text-secondary); margin-bottom: 24px; }
.modal .btn-row { display: flex; gap: 12px; }
.modal .btn-row .btn { flex: 1; }

/* ─── Fingerprint Animation ─── */
.fingerprint-capture {
    text-align: center;
    padding: 40px 20px;
}
.fingerprint-capture .fp-icon {
    font-size: 72px;
    animation: pulse 1.5s ease infinite;
    margin-bottom: 16px;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
}
.fingerprint-capture .fp-text { font-size: 16px; color: var(--text-secondary); }

/* ─── Loading ─── */
.loading-overlay {
    position: fixed; inset: 0;
    background: rgba(255,255,255,0.9);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    z-index: 9000;
}
.loading-overlay.active { display: flex; }
.loading-overlay .spinner-lg {
    width: 40px; height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.loading-overlay .loading-text { font-size: 15px; color: var(--text-secondary); }

/* ─── Toast / Alerts ─── */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 24px;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    animation: slideIn 0.3s ease;
    max-width: 400px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: #1565C0; }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(60px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ─── Subscription Timer Badge ─── */
.sub-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #FFF3E0;
    color: var(--accent);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.sub-badge.active { background: #E8F5E9; color: var(--success); }
.sub-badge.expired { background: #FFEBEE; color: var(--danger); }
