:root {
    --primary-color: #1e3a8a; /* Deep Blue */
    --secondary-color: #3b82f6; /* Bright Blue */
    --accent-color: #f59e0b; /* Gold / Tailoring vibe */
    --bg-color: #f8fafc;
    --sidebar-bg: #0f172a;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --white: #ffffff;
    --border-color: #e2e8f0;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    direction: rtl;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    color: var(--white);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    z-index: 10;
}

.logo {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.logo i {
    font-size: 1.75rem;
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.main-nav {
    padding: 1.5rem 0;
    flex: 1;
}

.main-nav ul {
    list-style: none;
}

.main-nav li {
    margin-bottom: 0.25rem;
}

.main-nav li a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: #94a3b8;
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
    border-right: 4px solid transparent;
}

.main-nav li a:hover, .main-nav li.active a {
    color: var(--white);
    background-color: rgba(255,255,255,0.03);
    border-right: 4px solid var(--accent-color);
}

.main-nav li.active a {
    background: linear-gradient(90deg, rgba(245,158,11,0.1) 0%, transparent 100%);
}

.main-nav li a i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg-color);
}

/* Header */
.top-header {
    height: 76px;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    z-index: 5;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--bg-color);
    padding: 0.75rem 1.25rem;
    border-radius: 50px;
    width: 350px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.search-bar:focus-within {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-bar i {
    color: var(--text-muted);
    margin-left: 0.75rem;
}

.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 0.95rem;
    color: var(--text-main);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.notifications {
    position: relative;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.25rem;
    transition: var(--transition);
}

.notifications:hover {
    color: var(--text-main);
}

.notifications .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--white);
}

.avatar img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--white);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--transition);
}

.avatar img:hover {
    transform: scale(1.05);
}

/* Content Area */
.content-area {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

/* Dashboard Placeholder Styles */
.dashboard-placeholder {
    animation: fadeIn 0.5s ease;
}

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

.dashboard-placeholder h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    font-weight: 800;
}

.dashboard-placeholder > p {
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    font-size: 1.1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background-color: var(--white);
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.02);
}

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

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.stat-info h3 {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
}

/* Premium UI Components: Buttons, Inputs, Tables */
.header-actions {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-actions h2 {
    color: var(--primary-color);
    font-weight: 800;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background-color: var(--white);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #f1f5f9;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table th, .data-table td {
    padding: 1.25rem 1rem;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background-color: #f1f5f9;
}

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

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.95rem;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: #f8fafc;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--secondary-color);
    background-color: var(--white);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

/* Modal/Card Backgrounds */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0,0,0,0.02);
}

/* Print Styles for A4 Receipt */
@media print {
    /* Hide Everything Else */
    body > * {
        display: none !important;
    }
    
    @page {
        size: A4 portrait;
        margin: 0;
    }
    
    body {
        background-color: white;
        margin: 0;
        padding: 0;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    #print-container {
        display: block !important;
        width: 100%;
        color: #d32f2f;
        font-family: 'Arial', 'Tajawal', sans-serif;
    }

    .print-receipt {
        width: 210mm;
        height: 296mm; /* Exactly A4 height minus 1mm */
        padding: 5mm 10mm;
        box-sizing: border-box;
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        overflow: hidden;
    }

    .print-receipt * {
        color: #d32f2f;
        border-color: #d32f2f;
    }
    .print-receipt .black-text {
        color: #000 !important;
    }

    /* Sections */
    .receipt-section {
        border: 2px solid #d32f2f;
        padding: 5mm;
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        flex: 1; /* Make sections fill available vertical space */
    }
    
    .receipt-section:nth-of-type(2) {
        flex: 1.3; /* Middle section needs slightly more vertical space */
    }

    .receipt-divider {
        border-top: 2px dashed #0000ff;
        margin: 3mm 0; /* Reduced to ensure it fits on one page */
    }

    /* Header */
    .receipt-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 2mm;
    }

    .receipt-logo {
        text-align: center;
    }
    
    .receipt-logo h1 {
        margin: 0;
        font-size: 22pt;
        font-weight: bold;
    }
    .receipt-logo p {
        margin: 2px 0;
        font-size: 10pt;
    }

    .receipt-number {
        font-size: 18pt;
        font-weight: bold;
    }

    /* Info Grid */
    .info-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 5px 15px;
        margin-bottom: 2mm;
    }
    .info-row {
        display: flex;
        border-bottom: 1px dotted #d32f2f;
        align-items: flex-end;
    }
    .info-label {
        white-space: nowrap;
        margin-left: 5px;
        font-size: 11pt;
    }
    .info-value {
        flex-grow: 1;
        color: #000 !important;
        font-weight: bold;
        text-align: center;
        font-size: 12pt;
    }

    /* Tables */
    .receipt-tables {
        display: flex;
        gap: 10mm;
        margin-top: 2mm;
    }
    .table-left, .table-right {
        flex: 1;
    }

    .print-table {
        width: 100%;
        border-collapse: collapse;
        text-align: center;
    }
    .print-table th, .print-table td {
        border: 1px solid #d32f2f;
        padding: 4px;
        font-size: 12pt;
        font-weight: bold;
    }
    
    .meas-table td:first-child {
        width: 60%;
        color: #000 !important;
    }

    /* Bottom Footer Text */
    .receipt-footer-note {
        text-align: center;
        font-weight: bold;
        margin-top: 5mm;
        font-size: 10pt;
    }
}

/* ==========================================
   Glassmorphism Auth Overlay & SaaS Styling
   ========================================== */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 10% 20%, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 1) 90%);
    z-index: 10000;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(15px);
    opacity: 0;
    transition: opacity 0.4s ease;
    padding: 1rem;
}

.auth-overlay.show {
    display: flex;
    opacity: 1;
}

.auth-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 460px;
    padding: 2.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    color: var(--white);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-overlay.show .auth-card {
    transform: translateY(0);
}

.auth-header {
    text-align: center;
}

.auth-header i {
    font-size: 2.5rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.4));
}

.auth-header h2 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: #94a3b8;
    font-size: 0.95rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.auth-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.auth-input-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #e2e8f0;
}

.auth-input-wrapper {
    position: relative;
}

.auth-input-wrapper i {
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.auth-input-wrapper input {
    width: 100%;
    padding: 0.85rem 3rem 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--white);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.auth-input-wrapper input:focus {
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}

.auth-btn {
    background: linear-gradient(135deg, var(--accent-color), #d97706);
    color: var(--white);
    padding: 0.85rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.auth-switch {
    text-align: center;
    font-size: 0.9rem;
    color: #94a3b8;
}

.auth-switch a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.auth-switch a:hover {
    text-decoration: underline;
}

.auth-pending-card {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.auth-pending-card i {
    font-size: 4rem;
    color: var(--accent-color);
    animation: authPulse 2s infinite;
}

@keyframes authPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* User display in header */
.header-username {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    margin-left: 0.5rem;
}

.btn-logout {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-logout:hover {
    color: #b91c1c;
    transform: scale(1.1);
}

