@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700;900&display=swap');

:root {
    --primary: #3498DB;
    --primary-dark: #2980b9;
    --secondary: #10b981;
    --sidebar: #1e272e;
    --success: #2ECC71;
    --bg-light: #f1f2f6;
    --dark: #2d3436;
    --accent: #f39c12;
}

body {
    font-family: 'Roboto', 'Segoe UI', sans-serif;
    background-color: var(--bg-light);
    color: var(--dark);
}

/* Glassmorphism */
.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.dark-glass {
    background: rgba(45, 52, 54, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Animations */
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

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

@keyframes pulse-soft {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.animate-slide-in {
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.view-section {
    display: none;
    animation: slideInUp 0.4s ease-out;
}

.view-section.active {
    display: block;
}

/* Sidebar & Navigation Framework */
#sidebar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s ease;
    z-index: 50; /* Higher than overlay and topbar */
}

#sidebar.auto-hide {
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    transform: translateX(-100%);
}

#sidebar.auto-hide.sidebar-visible {
    transform: translateX(0);
    box-shadow: 20px 0 50px rgba(0,0,0,0.5);
}

#sidebar.pinned {
    position: relative;
    transform: translateX(0);
}

#sidebar-overlay {
    z-index: 45; /* Just below sidebar */
    transition: opacity 0.3s ease;
}

#sidebar-trigger {
    z-index: 40; /* High enough to be reachable */
}

/* Sidebar Styling */
#sidebar {
    background: linear-gradient(180deg, #2d3436 0%, #0a1114 100%);
    box-shadow: 10px 0 30px rgba(0,0,0,0.1);
}

.nav-btn {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    color: #cbd5e1; /* Brighter inactive text - slate-300 */
}

.nav-btn:not(.active):hover {
    background: rgba(59, 130, 246, 0.15) !important;
    color: #ffffff !important;
    transform: translateX(4px);
}

.nav-btn.active {
    background: linear-gradient(90deg, #3498DB 0%, #5dade2 100%) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4) !important;
    transform: none;
}

.nav-btn.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: white;
    border-radius: 0 4px 4px 0;
}

/* Cards & Containers */
.card-premium {
    background: white;
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    transition: all 0.3s ease;
    border: 1px solid #f1f2f6;
}

.card-premium:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}

/* Input Styling */
input, select, textarea {
    transition: all 0.2s ease;
}

input:focus, select:focus {
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f2f6;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 100px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Modal System */
#modal-overlay {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}

#modal-overlay.active {
    opacity: 1 !important;
    display: flex !important;
}

#modal-overlay.hidden {
    display: none !important;
}

[id$="-modal"] {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[id$="-modal"].active {
    transform: scale(1) !important;
    opacity: 1 !important;
    display: block !important;
}

/* Sidebar Styling Restored */
#sidebar {
    background: #2C3E50;
    box-shadow: 10px 0 30px rgba(0,0,0,0.1);
}

.nav-btn.active {
    background: var(--primary) !important;
    color: white !important;
}

/* POS Specifics */
#pos-view.active {
    display: flex !important;
    height: calc(100vh - 80px);
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #2980b9 100%);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* Status Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Tables */
table thead th {
    background-color: #f8f9fa;
    color: #94a3b8;
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 1rem;
}

table tbody td {
    padding: 1rem;
    vertical-align: middle;
}

tr:hover td {
    background-color: #f8fafc;
}

/* Skeleton/Loading State */
.loading-pulse {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Gold Glowing Animation */
@keyframes gold-glow {
    0% { box-shadow: 0 0 5px rgba(255, 215, 0, 0.5), inset 0 0 5px rgba(255, 215, 0, 0.2); }
    50% { box-shadow: 0 0 20px rgba(255, 215, 0, 1), inset 0 0 10px rgba(255, 215, 0, 0.5); }
    100% { box-shadow: 0 0 5px rgba(255, 215, 0, 0.5), inset 0 0 5px rgba(255, 215, 0, 0.2); }
}

.gold-glow-ring {
    animation: gold-glow 2s infinite ease-in-out;
    border: 2px solid #FFD700 !important;
}

@keyframes gold-text-glow {
    0% { text-shadow: 0 0 5px rgba(255, 215, 0, 0.3); }
    50% { text-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 25px rgba(212, 175, 55, 0.4); }
    100% { text-shadow: 0 0 5px rgba(255, 215, 0, 0.3); }
}


/* Dark Mode Support */
body.dark-mode {
    background-color: #0f172a;
    color: #e2e8f0;
}

body.dark-mode header {
    background-color: rgba(30, 41, 59, 0.95) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

body.dark-mode #views-container {
    background-color: #020617 !important;
}

body.dark-mode .bg-white {
    background-color: #1e293b !important;
}

body.dark-mode .text-gray-800, 
body.dark-mode .text-gray-900,
body.dark-mode h1, body.dark-mode h2, body.dark-mode h3, body.dark-mode h4 {
    color: #f1f5f9 !important;
}

body.dark-mode .text-gray-600,
body.dark-mode .text-slate-600 {
    color: #cbd5e1 !important;
}

body.dark-mode .text-gray-500,
body.dark-mode .text-gray-400 {
    color: #94a3b8 !important;
}

body.dark-mode .border,
body.dark-mode .border-gray-100,
body.dark-mode .border-gray-200 {
    border-color: #334155 !important;
}

body.dark-mode table thead th {
    background-color: #0f172a !important;
    color: #94a3b8 !important;
}

body.dark-mode tr:hover td {
    background-color: #0f172a !important;
}

body.dark-mode input, 
body.dark-mode select, 
body.dark-mode textarea {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

body.dark-mode .card-premium,
body.dark-mode .bg-slate-50 {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

body.dark-mode .bg-gray-50,
body.dark-mode .bg-indigo-50 {
    background-color: #0f172a !important;
}

body.dark-mode .shadow-sm,
body.dark-mode .shadow-md,
body.dark-mode .shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2) !important;
}

body.dark-mode .modal-content {
    background-color: #1e293b !important;
    color: #f1f5f9;
}

/* Fix for POS grid in dark mode */
body.dark-mode #pos-products-grid tr:nth-child(even) {
    background-color: rgba(255,255,255,0.02);
}

body.dark-mode #pos-products-grid tr:hover {
    background-color: rgba(52, 152, 219, 0.2);
}