/* Global Vars & Resets */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --bg-color: #f7fafc;
    --text-color: #2d3748;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    /* Remove tap highlight on mobile */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding-top: 20px;
    padding-bottom: 80px;
    /* Space for bottom nav on mobile */
}

/* --- Navigation & Header --- */
.navbar {
    margin-bottom: 30px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    background: rgba(13, 110, 253, 0.95) !important;
    border-bottom: 3px solid #0056b3;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: 1px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.nav-link {
    transition: all 0.3s ease !important;
    font-weight: 500;
}

.nav-link:hover {
    transform: translateY(-2px);
    color: #ffd700 !important;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* --- Cards & Containers --- */
.card {
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: none;
    border-radius: 12px;
    transition: all 0.3s ease;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.95);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Disable hover effects on touch devices to prevent sticky states */
@media (hover: none) {
    .card:hover {
        transform: none;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    }
}

.card-body {
    padding: 25px;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    margin-bottom: 30px;
}

/* --- Dashboard Grid --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.dashboard-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.5);
    position: relative;
    overflow: hidden;
}

.dashboard-card i {
    font-size: 2.5rem;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.dashboard-card h5 {
    font-weight: 600;
    margin-bottom: 10px;
    color: #2d3748;
}

.dashboard-card p {
    color: #718096;
    font-size: 0.9rem;
    margin: 0;
}

.dashboard-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Card Color Variations */
.card-primary {
    border-top: 4px solid #0d6efd;
}

.card-primary:hover i {
    color: #0d6efd;
}

.card-success {
    border-top: 4px solid #198754;
}

.card-success:hover i {
    color: #198754;
}

.card-danger {
    border-top: 4px solid #dc3545;
}

.card-danger:hover i {
    color: #dc3545;
}

.card-warning {
    border-top: 4px solid #ffc107;
}

.card-warning:hover i {
    color: #ffc107;
}

.card-info {
    border-top: 4px solid #0dcaf0;
}

.card-info:hover i {
    color: #0dcaf0;
}

.card-dark {
    border-top: 4px solid #6c757d;
}

.card-dark:hover i {
    color: #6c757d;
}

/* --- Mobile Bottom Navigation --- */
.bottom-nav {
    display: none;
    /* Hidden by default (desktop) */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    justify-content: space-around;
    align-items: center;
    z-index: 1040;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.05);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #a0aec0;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 5px;
    border-radius: 12px;
    min-width: 60px;
}

.bottom-nav-item i {
    font-size: 1.4rem;
    margin-bottom: 4px;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.bottom-nav-item.active {
    color: var(--primary-color);
}

.bottom-nav-item.active i {
    transform: translateY(-2px);
}

/* FAB for Scan in Bottom Nav */
.bottom-nav-fab {
    background: var(--primary-gradient);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    margin-top: -25px;
    /* pop out */
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    border: 4px solid white;
    transition: transform 0.2s ease;
}

.bottom-nav-fab i {
    font-size: 1.5rem;
}

.bottom-nav-fab:active {
    transform: scale(0.95);
}

/* --- Mobile Breakpoints --- */
@media (max-width: 768px) {

    /* Layout Adjustments */
    body {
        padding-top: 0;
        background: #f0f2f5;
    }

    /* Hide desktop navbar */
    .desktop-nav {
        display: none !important;
    }

    /* Show mobile nav */
    .bottom-nav {
        display: flex;
    }

    /* Container Full Width */
    .container {
        padding: 20px 15px;
        margin: 15px 0 calc(60px + env(safe-area-inset-bottom));
        border-radius: 0 0 20px 20px;
        background: white;
    }

    /* Typography */
    h1,
    h2,
    h3 {
        letter-spacing: -0.5px;
    }

    /* Buttons */
    .btn {
        min-height: 44px;
        /* Touch target size */
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Alerts */
    .alert {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }

    /* Video/Camera */
    #video,
    video {
        border-radius: 16px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 9/16;
        object-fit: cover;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade {
    animation: fadeIn 0.4s ease forwards;
}

/* --- Login Page Styling --- */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

/* Add animated background shapes if desired later, for now clean gradient */

.login-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    padding: 40px;
    width: 100%;
    max-width: 450px;
    transition: transform 0.3s ease;
}

.login-card:hover {
    transform: translateY(-5px);
}

.login-header {
    text-align: center;
    margin-bottom: 35px;
}

.login-header i {
    font-size: 3rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 15px;
    filter: drop-shadow(0 4px 6px rgba(102, 126, 234, 0.3));
}

.login-header h3 {
    font-weight: 800;
    color: var(--text-color);
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.login-header p {
    color: #718096;
    font-size: 0.95rem;
    margin: 0;
}

/* Form Inputs */
.login-card .form-group {
    margin-bottom: 25px;
}

.login-card .form-label {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 8px;
    font-size: 0.9rem;
    display: block;
}

.login-card .form-label i {
    color: var(--primary-color);
    margin-left: 5px;
}

.login-card .input-group {
    position: relative;
    border-radius: 12px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.login-card .input-group:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    background: white;
}

.login-card .form-control {
    border: none;
    background: transparent;
    padding: 12px 15px;
    padding-left: 45px;
    /* Space for icon */
    height: 50px;
    font-size: 1rem;
    color: var(--text-color);
}

.login-card .form-control:focus {
    box-shadow: none;
    background: transparent;
}

.login-card .input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
    font-size: 1.1rem;
    transition: color 0.3s ease;
    z-index: 10;
}

.login-card .input-group:focus-within .input-icon {
    color: var(--primary-color);
}

/* Submit Button */
.btn-login {
    background: var(--primary-gradient);
    border: none;
    border-radius: 12px;
    height: 55px;
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(102, 126, 234, 0.4);
    color: white;
}

.btn-login:active {
    transform: translateY(1px);
}

/* Footer Links */
.form-text {
    text-align: center;
    margin-top: 25px;
    color: #a0aec0;
    font-size: 0.85rem;
}

.new-employee-link {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #edf2f7;
}

.new-employee-link span {
    display: block;
    margin-bottom: 5px;
    color: #718096;
}

.new-employee-link a {
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.2s;
}

.new-employee-link a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

.new-employee-link p {
    font-size: 0.75rem;
    color: #cbd5e0;
    margin-top: 10px;
}

/* ========================================
   تنسيقات الطباعة - Print Styles
   ======================================== */
@media print {
    /* إخفاء عناصر الواجهة الأساسية */
    .navbar,
    .nav-link,
    .navbar-brand,
    .btn,
    .d-flex.justify-content-between,
    .d-flex.align-items-center,
    .d-flex.gap-2,
    .form-control,
    .form-select,
    .form-check,
    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-danger,
    .btn-warning,
    .btn-info,
    .badge {
        display: none !important;
    }
    
    /* تنسيق الصفحة العام */
    body {
        background: white !important;
        color: #000 !important;
        font-family: Arial, sans-serif !important;
        padding: 0 !important;
        margin: 0 !important;
        min-height: auto !important;
    }
    
    .container,
    .container-fluid {
        max-width: 100% !important;
        width: 100% !important;
        padding: 10px !important;
        margin: 0 !important;
    }
    
    /* تنسيق البطاقات والعناصر */
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }
    
    .card-header {
        background: #e0e0e0 !important;
        color: #000 !important;
        border-bottom: 2px solid #000 !important;
        font-weight: bold;
    }
    
    .card-body {
        padding: 10px !important;
    }
    
    /* تنسيق الجداول */
    .table {
        width: 100%;
        border-collapse: collapse;
        margin: 10px 0;
    }
    
    .table thead {
        display: table-header-group;
        background: #d9d9d9 !important;
    }
    
    .table tbody {
        display: table-row-group;
    }
    
    .table th,
    .table td {
        padding: 6px 8px !important;
        border: 1px solid #000 !important;
        text-align: right;
        font-size: 10pt;
        page-break-inside: avoid;
    }
    
    .table th {
        font-weight: bold;
        background: #cccccc !important;
        text-align: center;
    }
    
    .table tr {
        page-break-inside: avoid;
    }
    
    .table-striped tbody tr:nth-of-type(even) {
        background: #f9f9f9 !important;
    }
    
    /* تنسيق الشارات والحالات */
    .badge {
        display: inline-block !important;
        border: 1px solid #000 !important;
        padding: 2px 6px !important;
        margin: 2px !important;
    }
    
    .badge.bg-success {
        background: #90EE90 !important;
        color: #000 !important;
    }
    
    .badge.bg-danger {
        background: #FFB6C6 !important;
        color: #000 !important;
    }
    
    .badge.bg-warning {
        background: #FFFFE0 !important;
        color: #000 !important;
    }
    
    .badge.bg-info {
        background: #87CEEB !important;
        color: #000 !important;
    }
    
    .badge.bg-primary {
        background: #87CEEB !important;
        color: #000 !important;
    }
    
    /* تنسيق الرؤوس */
    h1, h2, h3, h4, h5, h6 {
        margin-top: 15px !important;
        margin-bottom: 10px !important;
        page-break-after: avoid;
    }
    
    h2 {
        text-align: center;
        font-size: 14pt;
        font-weight: bold;
        border-bottom: 2px solid #000;
        padding-bottom: 10px;
    }
    
    h3 {
        font-size: 12pt;
        font-weight: bold;
        margin-top: 20px;
    }
    
    /* تنسيق التنبيهات */
    .alert {
        border: 1px solid #000 !important;
        padding: 8px !important;
        margin: 10px 0 !important;
        page-break-inside: avoid;
    }
    
    .alert-info {
        background: #e7f3ff !important;
        color: #000 !important;
    }
    
    .alert-warning {
        background: #fffacd !important;
        color: #000 !important;
    }
    
    .alert-danger {
        background: #ffe4e1 !important;
        color: #000 !important;
    }
    
    .alert-success {
        background: #e8f5e9 !important;
        color: #000 !important;
    }
    
    /* تنسيق الصور والمحتوى الإضافي */
    .table-responsive {
        overflow: visible !important;
    }
    
    .text-center {
        text-align: center;
    }
    
    .text-right {
        text-align: right;
    }
    
    /* إزالة الخلفيات الملونة */
    .bg-primary,
    .bg-secondary,
    .bg-success,
    .bg-danger,
    .bg-warning,
    .bg-info,
    .bg-light,
    .bg-dark {
        background: transparent !important;
        color: #000 !important;
    }
    
    /* مسافات الصفحات */
    @page {
        margin: 0.5in;
        size: A4;
    }
    
    /* تجنب تقسيم الصفوف والعناصر المهمة */
    tr, .card, .alert {
        page-break-inside: avoid;
    }
}