/* =========================================================
   PREMIUM UI DESIGN (MOBILE & DESKTOP)
   ========================================================= */

:root { 
    --primary: #0f172a; 
    --primary-light: #1e293b; 
    --gold: #f59e0b; 
    --green: #10b981; 
    --red: #ef4444;
    --whatsapp: #25D366; 
    --sms: #3b82f6; 
    --bg: #f8fafc; 
    --surface: #ffffff;
    --border: #e2e8f0;
    --text-main: #334155;
    --text-muted: #64748b;
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.02);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.05);
    --shadow-hover: 0 20px 25px -5px rgba(0,0,0,0.1);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
}

body { 
    font-family: 'Poppins', sans-serif; 
    margin: 0; 
    padding: 0; 
    background: var(--bg); 
    color: var(--text-main); 
    -webkit-font-smoothing: antialiased;
}

.container { max-width: 1400px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

/* HEADER & NAVIGATION */
header { 
    background: var(--surface); padding: 15px 30px; display: flex; justify-content: space-between; align-items: center; 
    box-shadow: var(--shadow-sm); position: sticky; top: 0; z-index: 100; 
    border-bottom: 3px solid transparent; border-image: linear-gradient(to right, #FF9933, #FFFFFF, #138808) 1; 
    position: relative; /* Crucial for dropdown positioning */
}

.logo h1 { margin: 0; font-size: clamp(1.2rem, 4vw, 1.6rem); font-weight: 700; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}

.nav-container { display: flex; align-items: center; gap: 10px; }
.mobile-top-actions { display: none; } /* Hidden on desktop */
.nav-menu-items { display: flex; gap: 10px; }

.nav-btn { 
    padding: 10px 20px; border: none; background: transparent; color: var(--text-muted); 
    border-radius: 50px; cursor: pointer; font-weight: 600; font-size: 0.9rem;
    transition: all 0.3s ease; white-space: nowrap; 
}
.nav-btn:hover { background: #f1f5f9; color: var(--primary); }
.nav-btn.active { background: var(--primary); color: white; box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2); }

.profile-trigger {
    flex-shrink: 0; width: 42px; height: 42px; background: #004a99; color: white; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-weight: bold; cursor: pointer;
    font-size: 1rem; text-transform: lowercase; position: relative; margin-left: 5px; transition: 0.3s; z-index: 1; overflow: hidden; box-shadow: var(--shadow-sm);
}
.profile-trigger:hover { transform: scale(1.08); }
.profile-trigger::after {
    content: ''; position: absolute; inset: -3px; border-radius: 50%; padding: 2px;
    background: linear-gradient(45deg, #ef4444, #f59e0b, #10b981, #3b82f6);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.profile-trigger img { width: 100%; height: 100%; object-fit: cover; }

/* APP CONTENT & CARDS */
.content { padding: 30px; flex: 1; }
.card { background: var(--surface); padding: 35px; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); margin-bottom: 25px; border: 1px solid rgba(255, 255, 255, 0.6); transition: box-shadow 0.3s ease;}
.card:hover { box-shadow: var(--shadow-hover); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.full { grid-column: span 2; }
label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; display: block; }

input, select, textarea { 
    width: 100%; padding: 14px 16px; background: #f8fafc; border: 1px solid var(--border); 
    border-radius: var(--radius-md); font-size: 0.95rem; outline: none; transition: all 0.3s ease; box-sizing: border-box; font-family: inherit; color: var(--text-main);
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.08); }

.btn { width: 100%; padding: 16px; border: none; border-radius: var(--radius-md); font-weight: 700; cursor: pointer; font-size: 1rem; margin-top: 20px; color: white; transition: all 0.2s ease;}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); }
.btn-primary:hover { opacity: 0.9; box-shadow: var(--shadow-md); }
.btn-green { background: var(--green); } .btn-red { background: var(--red); } .btn-blue { background: var(--sms); }
.btn-gold { background: var(--gold); color: #fff; font-weight: 700;}

.btn-edit, .btn-sm { padding: 10px 18px; background: var(--primary); color: white; border-radius: var(--radius-sm); font-size: 0.85rem; cursor:pointer; border:none; font-weight:600; transition: 0.2s;}
.btn-edit:hover, .btn-sm:hover { opacity: 0.9; transform: translateY(-1px); }

.list-container { max-height: 400px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-md); margin-top: 10px; }
.list-item { padding: 16px; border-bottom: 1px solid #f1f5f9; cursor: pointer; background: white; display: flex; justify-content: space-between; align-items: center; transition: 0.2s;}
.list-item:hover { background: #f8fafc; padding-left: 20px; }

.cart-table, .report-table { width:100%; border-collapse:collapse; margin:15px 0; }
th { text-align:left; background:#f1f5f9; padding:12px; font-size:0.85rem; color:var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;}
td { padding:14px 12px; border-bottom:1px solid #f1f5f9; font-size: 0.95rem; }

.status-sale, .status-return, .status-pay { padding: 6px 12px; border-radius: 50px; font-weight: bold; font-size: 0.8rem; }
.status-sale { color: var(--green); background: #ecfdf5; }
.status-return { color: var(--red); background: #fef2f2; }
.status-pay { color: var(--sms); background: #eff6ff; }

.info-card { background: #fff; margin-bottom: 12px; padding: 20px; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--border);}
.border-red { border-left: 5px solid var(--red); } .border-green { border-left: 5px solid var(--green); } .border-blue { border-left: 5px solid var(--sms); }

.phone-link { color: var(--sms); cursor: pointer; font-size: 0.9rem; margin-left: 5px; font-weight: 600; padding: 4px 8px; background: #eff6ff; border-radius: 6px;}

.profile-pic-container { width: 100px; height: 100px; border-radius: 50%; background: #f1f5f9; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 3px solid var(--border); box-shadow: var(--shadow-sm);}
.profile-pic-container img { width: 100%; height: 100%; object-fit: cover; }

/* ==============================================
   MOBILE PREMIUM DROPDOWN MENU STYLES
   ============================================== */
@media (max-width: 768px) {
    header { padding: 10px 15px; border-image: none; border-bottom: 2px solid var(--border); }
    .logo { display: none !important; } 
    
    .nav-container { width: 100%; justify-content: space-between; }
    
    /* Show Mobile Top Actions */
    .mobile-top-actions { display: flex; gap: 8px; }
    .mobile-bill-btn { padding: 8px 16px; font-size: 0.85rem; }
    .menu-toggle-btn { padding: 8px 16px; font-size: 0.85rem; background: #f1f5f9; color: var(--primary); }

    /* Hide Desktop specific items on mobile */
    .desktop-only-btn { display: none !important; }

    /* Transform nav-menu-items into a dropdown drawer */
    .nav-menu-items {
        display: none; /* Hidden by default on mobile */
        position: absolute;
        top: 100%; /* positioned right below header */
        left: 0;
        right: 0;
        background: var(--surface);
        flex-direction: column;
        padding: 15px;
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        border-bottom-left-radius: var(--radius-md);
        border-bottom-right-radius: var(--radius-md);
        z-index: 99;
    }

    /* Class added by JS to show menu */
    .nav-menu-items.show-menu { display: flex; }
    
    .nav-menu-items .nav-btn { 
        width: 100%; text-align: left; padding: 12px 15px; border-radius: var(--radius-sm); 
    }

    .content { padding: 15px; }
    .card { padding: 25px 20px; }
    .form-grid { grid-template-columns: 1fr; gap: 16px; }
    .full { grid-column: span 1; }
    .cart-table, .report-table { display: block; overflow-x: auto; white-space: nowrap; }
    .info-card { flex-direction: column; align-items: flex-start; gap: 15px; }
    .info-card > div { text-align: left !important; width: 100%; }
}

/* Modals */
.hidden { display: none !important; }
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: center; z-index: 1000; padding: 20px;}
.modal-box { background: white; padding: 30px; border-radius: var(--radius-lg); width: 100%; max-width: 500px; text-align: center; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); max-height: 85vh; overflow-y: auto; }

.auth-wrapper { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: var(--primary); padding: 20px; }
.auth-box { background: white; padding: 40px; border-radius: var(--radius-lg); width: 100%; max-width: 420px; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2); }
.auth-header { text-align: center; margin-bottom: 30px; }
.auth-header h1 { color: var(--primary); margin: 0; font-size: 1.8rem; font-weight: 800;}
.auth-form { display: flex; flex-direction: column; gap: 18px; }

/* SOLID SPLASH SCREEN STYLES */
.loader-overlay {
    position: fixed; inset: 0; background: var(--primary); 
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    z-index: 99999; color: white;
}
.spinner {
    width: 60px; height: 60px; border: 6px solid rgba(255,255,255,0.1);
    border-top-color: var(--gold); border-radius: 50%;
    animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }