/* ===== CLYIX OS DESIGN SYSTEM ===== */
:root {
    --navy: #001f3f;
    --navy-dark: #001226;
    --navy-light: #003366;
    --navy-gradient: linear-gradient(135deg, #001f3f 0%, #003366 100%);
    --navy-light-gradient: linear-gradient(135deg, #003366 0%, #004c99 100%);
    
    --primary: #0066cc;
    --primary-dark: #004999;
    --success: #28a745;
    --success-dark: #1e7e34;
    --danger: #dc3545;
    --danger-dark: #bd2130;
    --warning: #ffc107;
    --warning-dark: #d39e00;
    --info: #17a2b8;
    --info-dark: #117a8b;
    
    --card-bg: #ffffff;
    --body-bg: #f5f7fa;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #e1e4e8;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Courier New', monospace;
    
    --radius: 10px;
    --radius-lg: 16px;
    --radius-sm: 6px;
    
    --transition: all 0.2s ease-in-out;
    
    /* Safe area insets */
    --sat: env(safe-area-inset-top);
    --sar: env(safe-area-inset-right);
    --sab: env(safe-area-inset-bottom);
    --sal: env(safe-area-inset-left);
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --navy: #000c1a;
        --navy-light: #001f33;
        --card-bg: #1e1e1e;
        --body-bg: #121212;
        --text-primary: #ffffff;
        --text-secondary: #a0a6b0;
        --border-color: #404040;
    }
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font);
    background: var(--body-bg);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
    overflow-x: hidden;
}

/* ===== LOGIN PAGE ===== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--body-bg);
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.login-logo {
    background: var(--navy-gradient);
    width: 96px;
    height: 96px;
    border-radius: 24px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0,31,63,0.3);
}

.logo-icon {
    font-size: 56px;
    color: white;
}

.login-title {
    font-size: 36px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    color: var(--navy);
}

.login-subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 24px;
}

.login-form {
    margin-top: 24px;
}

.error-message {
    background: rgba(220,53,69,0.1);
    color: var(--danger);
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border-left: 4px solid var(--danger);
}

.demo-credentials {
    text-align: center;
    margin-top: 24px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== STICKY NAVY TOP BAR FOR MOBILE ===== */
.mobile-top-nav {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    background: var(--navy-gradient);
    color: white;
    padding: 12px 16px;
    padding-top: max(12px, var(--sat));
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.mobile-top-nav .logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-top-nav .logo-text {
    font-size: 20px;
    font-weight: 700;
    color: white;
}

.mobile-top-nav .user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-top-nav .user-name {
    color: rgba(255,255,255,0.95);
    font-size: 14px;
    font-weight: 500;
}

.mobile-top-nav .logout-btn {
    color: white;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 30px;
    background: rgba(255,255,255,0.15);
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
    border: 1px solid rgba(255,255,255,0.1);
}

.mobile-top-nav .logout-btn:hover {
    background: rgba(255,255,255,0.25);
}

/* ===== MOBILE NAVIGATION TABS ===== */
.mobile-nav-tabs {
    display: flex;
    background: var(--navy-light-gradient);
    padding: 10px 12px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    gap: 10px;
    position: sticky;
    top: 60px;
    top: calc(60px + var(--sat));
    z-index: 999;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.mobile-nav-tabs::-webkit-scrollbar {
    display: none;
}

.mobile-nav-tabs .tab {
    display: inline-block;
    padding: 8px 18px;
    background: rgba(255,255,255,0.1);
    color: white;
    border-radius: 30px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.mobile-nav-tabs .tab.active {
    background: white;
    color: var(--navy);
    border-color: white;
}

/* ===== DESKTOP SIDEBAR ===== */
@media (min-width: 1024px) {
    .desktop-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 280px;
        height: 100vh;
        background: var(--navy-gradient);
        border-right: 1px solid rgba(255,255,255,0.1);
        padding: 28px;
        overflow-y: auto;
        z-index: 100;
        box-shadow: var(--shadow-lg);
        color: white;
    }
    
    .desktop-main {
        margin-left: 280px;
        min-height: 100vh;
    }
    
    .mobile-top-nav,
    .mobile-nav-tabs {
        display: none;
    }
}

.sidebar-header {
    margin-bottom: 32px;
}

.sidebar-logo {
    background: rgba(255,255,255,0.1);
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
}

.sidebar-title {
    font-weight: 700;
    font-size: 24px;
    color: white;
    margin-bottom: 8px;
}

.sidebar-welcome {
    color: rgba(255,255,255,0.8);
    margin-top: 4px;
    font-size: 15px;
}

.sidebar-role {
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-link {
    padding: 12px 16px;
    border-radius: var(--radius);
    text-decoration: none;
    color: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-link.active {
    background: var(--navy-light-gradient);
    color: white;
    border: 1px solid rgba(255,255,255,0.1);
}

.nav-link.logout-link {
    margin-top: 32px;
    background: rgba(220,53,69,0.2);
    color: rgba(255,255,255,0.95);
}

.nav-icon {
    font-size: 1.2rem;
}

/* ===== MAIN CONTENT ===== */
.app-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 12px;
    padding-bottom: 20px;
}

@media (min-width: 1024px) {
    .app-container {
        max-width: 1400px;
        padding: 24px;
    }
}

/* ===== GRID SYSTEMS ===== */
.grid-2, .grid-3, .grid-4 {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

@media (min-width: 768px) {
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ===== CARDS ===== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--navy);
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.card-icon {
    font-size: 1.4rem;
}

.card-text {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.section-title {
    margin-bottom: 16px;
    font-size: 18px;
    color: var(--navy);
}

/* ===== GRADIENT BUTTONS ===== */
.btn, button, 
input[type="submit"], 
input[type="button"] {
    border: none;
    border-radius: var(--radius);
    padding: 12px 24px;
    color: white;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}

.btn::before, button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before, button:hover::before {
    left: 100%;
}

.btn:hover, button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.btn:active, button:active {
    transform: translateY(0);
}

.btn-navy {
    background: var(--navy-gradient);
    box-shadow: 0 4px 12px rgba(0,31,63,0.3);
}

.btn-navy-light {
    background: var(--navy-light-gradient);
    box-shadow: 0 4px 12px rgba(0,51,102,0.3);
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #34ce57 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #ff4d5e 100%);
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ffdb6d 100%);
    color: #212529;
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8 0%, #3dd5f3 100%);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--navy);
    color: var(--navy);
    box-shadow: none;
}

.btn-outline:hover {
    background: var(--navy-gradient);
    color: white;
    border-color: transparent;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

/* ===== STATS CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
}

.stat-card {
    background: var(--card-bg);
    padding: 16px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--navy-gradient);
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--navy);
    line-height: 1;
}

.stat-value.success {
    color: var(--success);
}

.stat-value.warning {
    color: var(--warning);
}

.stat-value.danger {
    color: var(--danger);
}

/* ===== FORM ELEMENTS ===== */
.form-group {
    margin-bottom: 16px;
}

input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 15px;
    margin-bottom: 0;
    background: var(--card-bg);
    transition: var(--transition);
    font-family: var(--font);
    color: var(--text-primary);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(0,31,63,0.1);
}

input.readonly-input {
    background: rgba(0,31,63,0.05);
    cursor: not-allowed;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

@media (min-width: 640px) {
    .form-row {
        flex-direction: row;
    }
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.form-checkbox input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

/* ===== TABLES ===== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 8px 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    text-align: left;
    padding: 14px 12px;
    background: rgba(0,31,63,0.05);
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: rgba(0,31,63,0.02);
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: linear-gradient(135deg, #28a745 0%, #34ce57 100%);
    color: white;
}

.badge-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ffdb6d 100%);
    color: #212529;
}

.badge-danger {
    background: linear-gradient(135deg, #dc3545 0%, #ff4d5e 100%);
    color: white;
}

.badge-info {
    background: linear-gradient(135deg, #17a2b8 0%, #3dd5f3 100%);
    color: white;
}

.badge-primary {
    background: var(--navy-gradient);
    color: white;
}

/* ===== TICKET STYLES ===== */
.ticket-code {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    background: rgba(0,31,63,0.1);
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
}

.price {
    font-weight: 600;
    color: var(--navy);
}

/* ===== STATS LISTS ===== */
.stats-list {
    padding: 8px 0;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-amount {
    font-weight: 700;
}

.stat-amount.success { color: var(--success); }
.stat-amount.danger { color: var(--danger); }
.stat-amount.primary { color: var(--navy); }

.stats-vertical {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
}

.stat-badge {
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 50px;
    background: rgba(0,31,63,0.1);
}

.stat-badge.success { color: var(--success); }
.stat-badge.primary { color: var(--navy); }

/* ===== QUICK ACTIONS ===== */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ===== POS CART ===== */
.product-list {
    margin-bottom: 16px;
}

.product-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(0,31,63,0.02);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

@media (min-width: 640px) {
    .product-row {
        flex-direction: row;
        align-items: center;
    }
}

.product-select {
    flex: 2;
}

.qty-input {
    flex: 0.5;
}

.cart-summary {
    background: rgba(0,31,63,0.03);
    padding: 20px;
    border-radius: var(--radius);
    margin: 20px 0;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 6px 0;
}

.summary-row.total {
    font-size: 18px;
    font-weight: 700;
    border-top: 2px solid var(--border-color);
    margin-top: 12px;
    padding-top: 16px;
    color: var(--navy);
}

/* ===== STOCK ALERTS ===== */
.stock-alerts {
    max-height: 300px;
    overflow-y: auto;
}

.alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.alert-item:last-child {
    border-bottom: none;
}

.stock-level.warning {
    color: var(--warning);
    font-weight: 600;
}

/* ===== TRANSITIONING DEPRESSION ICONS ===== */
.transition-icon,
.logo-icon,
.nav-icon,
.btn-icon,
.card-icon {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.transition-icon:hover,
.logo-icon:hover,
.nav-icon:hover,
.btn:hover .btn-icon,
.card:hover .card-icon {
    transform: scale(1.2) rotate(360deg);
}

.depression-icon {
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.depression-icon:active,
.nav-link:active .nav-icon,
.btn:active .btn-icon {
    transform: scale(0.85) translateY(2px);
}

/* ===== RESPONSIVE UTILITIES ===== */
@media (max-width: 1023px) {
    .desktop-sidebar,
    .desktop-only {
        display: none !important;
    }
    
    .mobile-top-nav,
    .mobile-nav-tabs {
        display: flex;
    }
}

@media (min-width: 1024px) {
    .mobile-top-nav,
    .mobile-nav-tabs,
    .mobile-only {
        display: none !important;
    }
    
    .desktop-sidebar {
        display: block;
    }
}

/* ===== SAFE AREA SUPPORT (IPHONE NOTCH) ===== */
@supports (padding: max(0px)) {
    .mobile-top-nav {
        padding-top: max(12px, var(--sat));
        padding-left: max(16px, var(--sal));
        padding-right: max(16px, var(--sar));
    }
    
    .mobile-nav-tabs {
        top: max(60px, calc(60px + var(--sat)));
        padding-left: max(12px, var(--sal));
        padding-right: max(12px, var(--sar));
    }
    
    .app-container {
        padding-left: max(12px, var(--sal));
        padding-right: max(12px, var(--sar));
        padding-bottom: max(20px, var(--sab));
    }
}

/* ===== IOS SPECIFIC FIXES ===== */
@supports (-webkit-touch-callout: none) {
    input, select, textarea {
        font-size: 16px;
    }
    
    .btn, button {
        -webkit-appearance: none;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(0,31,63,0.4); }
    70% { box-shadow: 0 0 0 10px rgba(0,31,63,0); }
    100% { box-shadow: 0 0 0 0 rgba(0,31,63,0); }
}

.pulse {
    animation: pulse 2s infinite;
}

/* ===== PRINT STYLES ===== */
@media print {
    .desktop-sidebar,
    .mobile-top-nav,
    .mobile-nav-tabs,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .desktop-main {
        margin-left: 0 !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }
}