/* public/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #4F46E5; /* Indigo */
    --primary-hover: #4338CA;
    --secondary: #10B981; /* Emerald */
    --bg-dark: #0F172A;
    --bg-darker: #020617;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-light: #F8FAFC;
    --text-muted: #94A3B8;
    --danger: #EF4444;
    --border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    --glass-blur: blur(10px);
    --input-bg: rgba(15, 23, 42, 0.6);
}

[data-theme="light"] {
    --bg-dark: #F8FAFC;
    --bg-darker: #F1F5F9;
    --card-bg: rgba(255, 255, 255, 0.8);
    --text-light: #0F172A;
    --text-muted: #475569;
    --border: rgba(0, 0, 0, 0.1);
    --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
    --input-bg: rgba(255, 255, 255, 0.6);
}

[data-theme="light"] body {
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,90%,1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,80%,0.3) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,80%,0.3) 0, transparent 50%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-darker);
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,0.3) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,0.3) 0, transparent 50%);
    background-attachment: fixed;
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
}

/* Glassmorphism Classes */
.glass {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
}

.glass-panel {
    padding: 24px;
}

/* Layout */
.system-header {
    width: 100%;
    height: 70px;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    z-index: 200;
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 24px;
    cursor: pointer;
}

[data-theme="light"] .menu-toggle {
    color: var(--text-light); /* This is already handled by data-theme changing --text-light */
}

.system-header .logo {
    margin-bottom: 0;
}

.module-dropdown {
    position: relative;
    display: inline-block;
}

.module-dropdown-btn {
    padding: 8px 16px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s;
}

.module-dropdown-btn:hover {
    background: rgba(79, 70, 229, 0.2);
}

.module-dropdown-content {
    display: block;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 10px;
    background: var(--bg-dark);
    min-width: 200px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 12px;
    z-index: 300;
    overflow: hidden;
}

.module-dropdown.open .module-dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.module-dropdown-content a {
    color: var(--text-light);
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    font-size: 14px;
    transition: background 0.3s;
}

.module-dropdown-content a:hover, .module-dropdown-content a.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary);
}

.sidebar {
    width: 260px;
    height: calc(100vh - 70px);
    position: fixed;
    left: 0;
    top: 70px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border);
    z-index: 100;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
    width: 5px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
[data-theme="light"] .sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}
[data-theme="light"] .sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.sidebar.show {
    transform: translateX(0);
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo span {
    color: var(--primary);
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    padding: 12px 16px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-links a:hover, .nav-links a.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
    transform: translateX(5px);
}

/* Sidebar Dropdown */
.nav-dropdown .dropdown-menu {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease-out;
    list-style: none;
    margin-top: 5px;
    padding-left: 10px;
    border-left: 1.5px solid var(--border);
    margin-left: 24px;
}

.nav-dropdown.open .dropdown-menu {
    max-height: 300px;
    opacity: 1;
    margin-bottom: 5px;
}

.dropdown-toggle {
    display: flex;
    justify-content: space-between !important;
    align-items: center;
}

.dropdown-icon {
    transition: transform 0.3s ease;
}

.nav-dropdown.open .dropdown-icon {
    transform: rotate(180deg);
}

.nav-links .dropdown-menu a {
    color: var(--text-muted);
    padding: 10px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    font-weight: 400;
    transition: all 0.2s ease;
    transform: none;
    box-shadow: none;
    background: transparent;
}

.nav-links .dropdown-menu a:hover {
    color: var(--text-light);
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
    box-shadow: none;
}

.nav-links .dropdown-menu a.active {
    color: var(--text-light);
    background: rgba(79, 70, 229, 0.15);
    font-weight: 500;
    border-left: 3px solid var(--primary);
    border-radius: 0 8px 8px 0;
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

.main-content {
    margin-left: 260px;
    margin-top: 70px;
    padding: 30px;
    width: calc(100% - 260px);
    min-height: calc(100vh - 70px);
    transition: margin-left 0.3s ease, width 0.3s ease;
}

/* Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-title {
    font-size: 28px;
    font-weight: 600;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
}

.btn-success {
    background: var(--secondary);
    color: white;
}

.btn-success:hover {
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-icon {
    padding: 5px 10px;
    background: var(--input-bg);
    color: var(--text-light);
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 15px;
    outline: none;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Grid Layouts */
.grid {
    display: grid;
    gap: 24px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Dashboard Cards */
.stat-card {
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-info h3 {
    font-size: 28px;
    margin-bottom: 5px;
}

.stat-info p {
    color: var(--text-muted);
    font-size: 14px;
}

/* Auth Pages */
.auth-wrapper {
    min-height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h2 {
    font-size: 28px;
    margin-bottom: 10px;
}

.auth-header p {
    color: var(--text-muted);
}

/* Mobile Responsiveness */
@media (max-width: 992px) {
    .grid-4, .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
        margin-right: 15px;
    }
    
    .system-header {
        padding: 0 15px;
    }
    
    .system-header .logo span {
        display: none; /* Hide text on mobile, just show icon */
    }
    
    .module-dropdown-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
        z-index: 1000;
    }
    
    .sidebar.show {
        transform: translateX(0) !important;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 15px;
    }
    
    .grid-2, .grid-4, .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .user-profile > div:last-child {
        display: none; /* Hide user name and role on mobile */
    }

    .user-profile {
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }
    
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    /* Responsive Header Panels */
    .glass-panel[style*="justify-content: space-between"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 15px !important;
    }
    
    .glass-panel[style*="justify-content: space-between"] > div {
        width: 100% !important;
    }
    
    .glass-panel[style*="justify-content: space-between"] > div:last-child {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
        justify-content: flex-start !important;
    }
    
    .glass-panel[style*="justify-content: space-between"] > div:last-child .btn {
        flex: 1;
        justify-content: center;
    }
    
    /* POS Mobile View */
    .pos-container {
        flex-direction: column !important;
        height: auto !important;
        gap: 15px !important;
    }
    
    .pos-container > div {
        flex: none !important;
        height: 50vh; /* Set a fixed height for each panel on mobile so they can scroll internally */
    }
    
    #quickProducts {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .pos-footer {
        position: relative !important;
        flex-direction: column !important;
        height: auto !important;
        padding: 15px !important;
        gap: 15px !important;
        align-items: stretch !important;
    }
    
    .pos-footer > div:first-child {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pos-footer > div:nth-child(2) {
        margin: 0 auto !important;
    }
    
    .pos-footer .btn {
        flex: 1;
        justify-content: center;
        white-space: nowrap;
    }
}

/* Premium Custom Select arrows & Badges */
select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 40px !important;
}

select.form-control option {
    background-color: var(--bg-dark);
    color: var(--text-light);
}

[data-theme="light"] select.form-control option {
    background-color: var(--bg-darker);
    color: var(--text-light);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
    border: 1px solid transparent;
}

.badge i {
    font-size: 14px;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #10B981;
    border-color: rgba(16, 185, 129, 0.2);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #F59E0B;
    border-color: rgba(245, 158, 11, 0.2);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
    border-color: rgba(239, 68, 68, 0.2);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: #3B82F6;
    border-color: rgba(59, 130, 246, 0.2);
}

/* Color Helper Utilities */
.text-danger {
    color: var(--danger) !important;
}

.text-success {
    color: var(--secondary) !important;
}

/* Action Dropdown Styles */
.action-dropdown {
    position: relative;
    display: inline-block;
}

.action-btn {
    background-color: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    transition: all 0.2s;
}

.action-btn:hover {
    background-color: rgba(59, 130, 246, 0.2);
}

.action-dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--card-bg);
    min-width: 140px;
    box-shadow: 0px 8px 24px 0px rgba(0,0,0,0.3);
    z-index: 100;
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
    left: 0;
    top: 100%;
    margin-top: 5px;
}

.action-dropdown-content a {
    color: var(--text-light);
    padding: 10px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    transition: background-color 0.2s;
}

.action-dropdown-content a:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.show-dropdown {
    display: block;
    animation: fadeInDropdown 0.2s ease-out;
}

@keyframes fadeInDropdown {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}
