:root {
    /* Color Palette - Medical & Trust */
    --primary: #0F766E; /* Deep Teal */
    --primary-light: #14B8A6; /* Teal */
    --secondary: #2DD4BF; /* Bright Teal */
    --accent: #F59E0B; /* Amber/Warning */
    --danger: #EF4444; /* Red/Alert */
    --success: #22C55E; /* Green/Success */
    --background: #F1F5F9; /* Slate 100 */
    --surface: rgba(255, 255, 255, 0.85);
    --surface-solid: #FFFFFF;
    --text-primary: #1E293B; /* Slate 800 */
    --text-secondary: #64748B; /* Slate 500 */
    --border: #E2E8F0; /* Slate 200 */
    
    /* Layout Tokens */
    --sidebar-width: 260px;
    --header-height: 80px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-blur: blur(12px);
    --glass-border: rgba(255, 255, 255, 0.5);
    
    /* Typography */
    --font-main: 'Outfit', sans-serif;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-main);
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

ul {
    list-style: none;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

input, select, textarea {
    font-family: inherit;
    border: none;
    outline: none;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.logo span {
    font-size: 32px;
    color: var(--secondary);
}

.logo h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: var(--spacing-sm) 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px var(--spacing-lg);
    transition: all 0.3s ease;
    opacity: 0.7;
    cursor: pointer;
}

.nav-item:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    box-shadow: inset 4px 0 0 var(--secondary);
}

.nav-item span:first-child {
    font-size: 24px;
}

.nav-item span:last-child {
    font-size: 16px;
    font-weight: 500;
}

.sidebar-footer {
    padding: 16px var(--spacing-lg);
    background: rgba(0, 0, 0, 0.1);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--secondary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--primary);
}

.user-info .user-name {
    font-size: 14px;
    font-weight: 600;
}

.user-info .user-role {
    font-size: 12px;
    opacity: 0.7;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: var(--spacing-lg);
}

.top-bar {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-xl);
    padding: 0 var(--spacing-md);
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--surface-solid);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: 50px;
    box-shadow: var(--shadow-sm);
    width: 400px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.search-bar:focus-within {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
    width: 450px;
}

.search-bar input {
    flex: 1;
    margin-left: var(--spacing-sm);
    font-size: 14px;
}

.search-bar span {
    color: var(--text-secondary);
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.icon-btn:hover {
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.icon-btn .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.notification-dropdown {
    position: absolute;
    top: 60px;
    right: 0;
    width: 320px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideDown 0.3s ease forwards;
}

.notification-dropdown.active {
    display: flex;
}

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

.notification-header {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h4 {
    font-size: 14px;
    font-weight: 700;
}

.notification-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.notification-item:hover {
    background: #f8fafc;
}

.notification-item.unread {
    background: #f1f5f9;
}

.notification-item .notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notif-icon.info { background: #E0F2FE; color: #0EA5E9; }
.notif-icon.warning { background: #FFFBEB; color: #F59E0B; }
.notif-icon.danger { background: #FEF2F2; color: #EF4444; }
.notif-icon.success { background: #F0FDF4; color: #22C55E; }

.notification-content {
    flex: 1;
}

.notification-content p {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-primary);
}

.notification-content .notif-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.notification-footer {
    padding: var(--spacing-sm);
    text-align: center;
    border-top: 1px solid var(--border);
}

/* Views */
.view {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.view.active {
    display: block;
}

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

.view-header {
    margin-bottom: var(--spacing-xl);
}

.view-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.date-today {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.stat-card {
    background: var(--surface-solid);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon span {
    font-size: 28px;
}

.stat-icon.sales { background: #E0F2FE; color: #0EA5E9; }
.stat-icon.orders { background: #F0FDF4; color: #22C55E; }
.stat-icon.expiry { background: #FEF2F2; color: #EF4444; }
.stat-icon.stock { background: #FFFBEB; color: #F59E0B; }

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    margin: 2px 0;
}

.stat-trend {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-trend.positive { color: var(--success); }
.stat-trend span { font-size: 16px; }

.stat-alert {
    font-size: 12px;
    color: var(--danger);
    font-weight: 600;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--spacing-lg);
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: var(--spacing-md);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: var(--spacing-md);
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: #DCFCE7; color: #166534; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger { background: #FEE2E2; color: #991B1B; }

/* Alert List */
.alert-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.alert-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--border);
}

.alert-item.urgent { border-left: 4px solid var(--danger); }
.alert-item.urgent span { color: var(--danger); }
.alert-item.warning { border-left: 4px solid var(--accent); }
.alert-item.warning span { color: var(--accent); }

.alert-title {
    font-size: 14px;
    font-weight: 600;
}

.alert-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 14px;
    border: 1px solid transparent;
}

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

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.3);
}

.btn-outline {
    background: white;
    border-color: var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

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

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

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

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

.btn-text {
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
}

.btn-text:hover {
    text-decoration: underline;
}

/* Expiry States */
.expiry-status {
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
}
.expiry-status.safe { background: #DCFCE7; color: #166534; }
.expiry-status.warning { background: #FEF3C7; color: #92400E; }
.expiry-status.urgent { background: #FFEDD5; color: #9A3412; }
.expiry-status.expired { background: #FEE2E2; color: #991B1B; }

/* POS Terminal Layout */
.pos-container {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: var(--spacing-lg);
}

.pos-cart-items {
    max-height: 500px;
    overflow-y: auto;
}

.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-weight: 600;
    font-size: 15px;
}

.cart-item-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 20px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

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

.summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.summary-line.total {
    font-size: 22px;
    font-weight: 700;
    margin-top: 8px;
}

.pos-top-actions {
    display: flex;
    gap: 12px;
}

.badge-primary { background: var(--secondary); color: var(--primary); }

/* Helper Classes */
.icon-btn-sm {
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.icon-btn-sm:hover {
    background: rgba(0, 0, 0, 0.05);
}

.hidden { display: none !important; }

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal {
    background: white;
    width: 90%;
    max-width: 600px;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-lg);
    animation: modalSlide 0.3s ease forwards;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.close-modal {
    color: var(--text-secondary);
}

.close-modal:hover {
    color: var(--danger);
}

/* Login Page Styles */
.login-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.login-card {
    background: white;
    width: 100%;
    max-width: 400px;
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    text-align: center;
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.login-logo img {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
}

.login-logo h2 {
    font-size: 24px;
    color: var(--primary);
    font-weight: 700;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: all 0.2s ease;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.login-error {
    color: var(--danger);
    font-size: 13px;
    font-weight: 500;
    margin-top: 4px;
    display: none;
}

/* Sidebar Logout Button */
.logout-btn {
    margin-top: 12px;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: #FEE2E2;
    background: rgba(239, 68, 68, 0.1);
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: white;
}

.logout-btn span {
    font-size: 18px;
}
/* Reports Styles */
.report-tab {
    padding: 12px 20px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.report-tab:hover {
    color: var(--primary);
}

.report-tab.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.report-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* Print Styles for Reports */
@media print {
    .sidebar, .top-header, .report-tab, .filter-controls, .search-bar, .no-print {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .app-container {
        display: block !important;
    }
    
    #report-content-area {
        padding: 0 !important;
    }
    
    #report-store-header {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        display: block !important;
        padding-top: 0 !important;
    }

    .data-table {
        font-size: 10px !important;
    }
    
    .data-table th, .data-table td {
        padding: 4px 8px !important;
    }

    body {
        background: white !important;
    }
}
