@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap');

:root {
    /* Colors */
    --primary-gradient: linear-gradient(135deg, #0ea5e9, #4f46e5);
    --success-gradient: linear-gradient(135deg, #10b981, #059669);
    --surface-color: #ffffff;
    --bg-color: #f8fafc;
    --border-color: #e5e7eb;
    --border-color-light: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --primary-color: #0ea5e9;
    --primary-light: #e0f2fe;
    
    /* Shadows - refined for minimal look */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.03);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.05), 0 1px 2px -1px rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    
    /* Spacing Scale */
    --space-xs: 0.25rem;   /* 4px */
    --space-sm: 0.5rem;    /* 8px */
    --space-md: 1rem;      /* 16px */
    --space-lg: 1.5rem;    /* 24px */
    --space-xl: 2rem;      /* 32px */
    --space-2xl: 2.5rem;   /* 40px */
    --space-3xl: 3rem;     /* 48px */
    --space-4xl: 4rem;     /* 64px */
    
    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Touch Target */
    --touch-target-min: 44px;
    
    /* Typography Scale */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
}

/* ================================
   NAVBAR
================================ */
.navbar {
    background-color: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-xs);
}

.navbar-brand-icon {
    background: var(--primary-gradient);
    width: 40px; 
    height: 40px;
}

/* ================================
   CARDS - Refined Minimal Style
================================ */
.card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: #d1d5db;
}

.card-body {
    padding: var(--space-xl);
}

/* ================================
   FILE UPLOAD STYLES
================================ */
.file-drop-area {
    border: 2px dashed #d1d5db;
    border-radius: var(--radius-lg);
    padding: var(--space-2xl) var(--space-xl);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-slow);
    background-color: var(--bg-color);
    position: relative;
    overflow: hidden;
}

.file-drop-area:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
}

.file-drop-area.has-file {
    border-style: solid;
    border-color: var(--primary-color);
    background-color: var(--primary-light);
}

.file-name-display {
    color: var(--text-secondary);
    font-weight: 500;
}

.file-name-selected {
    color: var(--primary-color);
    font-weight: 700;
}

input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

/* ================================
   FORM CONTROLS - Enhanced Focus States
================================ */
.form-select,
.form-control {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-size: var(--text-base);
    min-height: var(--touch-target-min);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    background-color: var(--surface-color);
}

.form-select:focus,
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
    outline: none;
}

.form-select:hover,
.form-control:hover {
    border-color: #9ca3af;
}

.form-select-lg {
    padding: 1rem 1.25rem;
    font-size: var(--text-lg);
}

.form-label {
    margin-bottom: var(--space-sm);
    font-weight: 600;
    color: var(--text-primary);
}

/* ================================
   BUTTON STYLES - Touch Friendly
================================ */
.btn {
    min-height: var(--touch-target-min);
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.btn-primary-custom {
    background: var(--primary-gradient);
    border: none;
    padding: 0.875rem 1.75rem;
    font-weight: 700;
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    color: white;
    box-shadow: 0 2px 4px -1px rgba(79, 70, 229, 0.15);
    min-height: var(--touch-target-min);
}

.btn-primary-custom:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px -4px rgba(79, 70, 229, 0.25);
    color: white;
}

.btn-primary-custom:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px -1px rgba(79, 70, 229, 0.15);
}

.btn-success-custom {
    background: var(--success-gradient);
    border: none;
    font-weight: 700;
    border-radius: var(--radius-lg);
    color: white;
    padding: 0.875rem 1.75rem;
    box-shadow: 0 2px 4px -1px rgba(16, 185, 129, 0.15);
    transition: all var(--transition-base);
    min-height: var(--touch-target-min);
}

.btn-success-custom:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px -4px rgba(16, 185, 129, 0.25);
    color: white;
}

.btn-confirm {
    background: var(--primary-gradient);
    border: none;
    font-weight: 700;
    border-radius: var(--radius-lg);
    padding: 1rem 2rem;
    color: white;
    transition: all var(--transition-base);
    min-height: var(--touch-target-min);
}

.btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -4px rgba(14, 165, 233, 0.25);
    color: white;
}

.btn-cancel {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    font-weight: 600;
    border-radius: var(--radius-lg);
    padding: 1rem 2rem;
    color: var(--text-secondary);
    transition: all var(--transition-base);
    min-height: var(--touch-target-min);
}

.btn-cancel:hover {
    background-color: var(--bg-color);
    color: var(--text-primary);
    border-color: #d1d5db;
}

.btn-outline-secondary {
    min-height: var(--touch-target-min);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background-color: var(--bg-color);
    border-color: #d1d5db;
    color: var(--text-primary);
}

/* ================================
   STEPS & BADGES
================================ */
.badge-step {
    background-color: var(--primary-light);
    color: #0284c7;
    border: 1px solid #bae6fd;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
}

.step-indicator {
    width: 40px; 
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: var(--text-lg);
    background-color: var(--border-color-light);
    color: var(--text-secondary);
    transition: all var(--transition-slow);
    flex-shrink: 0;
}

.step-indicator.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15);
}

/* ================================
   STICKY ACTION BAR
================================ */
.sticky-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    border-top: 1px solid var(--border-color);
    padding: var(--space-md) var(--space-lg);
    z-index: 1000;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.03);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ================================
   STEP 3: SUMMARY CARDS
================================ */
.summary-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.summary-section {
    animation: fadeIn 0.5s ease-out;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-xs);
}

.section-title {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.section-badge {
    background-color: var(--border-color-light);
    color: var(--text-primary);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: var(--text-sm);
}

.file-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-lg);
}

.file-summary-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.file-summary-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #d1d5db;
}

.file-summary-card.status-success {
    border-right: 4px solid #10b981;
}

.file-summary-card.status-warning {
    border-right: 4px solid #f59e0b;
}

.file-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-sm);
}

.file-type-badge {
    font-size: var(--text-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-lec { background-color: #eff6ff; color: #3b82f6; }
.badge-lab { background-color: #f0fdf4; color: #22c55e; }

.file-stats {
    display: flex;
    gap: var(--space-md);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    background-color: var(--bg-color);
    padding: var(--space-md);
    border-radius: var(--radius-md);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.stat-value {
    font-weight: 700;
    color: var(--text-primary);
}

.btn-details {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all var(--transition-fast);
    min-height: var(--touch-target-min);
    cursor: pointer;
}

.btn-details:hover {
    background-color: var(--bg-color);
    color: var(--text-primary);
    border-color: #d1d5db;
}

/* ================================
   UTILITIES
================================ */
.pointer-events-none { pointer-events: none; }
.text-transparent { color: transparent; }
.bg-clip-text { -webkit-background-clip: text; background-clip: text; }

/* ================================
   STEP VISIBILITY
================================ */
.step-section {
    display: none;
}

.step-section.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

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

/* ================================
   SPINNER OVERLAY
================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease-out;
}

/* ================================
   MODAL POLISH
================================ */
.modal-content {
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-lg);
    background-color: var(--bg-color);
}

.modal-body {
    padding: 0;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: var(--space-lg);
    background-color: var(--bg-color);
}

/* ================================
   RESPONSIVE: TABLET (max-width: 768px)
================================ */
@media (max-width: 768px) {
    :root {
        --text-3xl: 1.5rem;
        --text-4xl: 1.875rem;
    }
    
    body {
        font-size: var(--text-sm);
    }
    
    .display-5 {
        font-size: var(--text-2xl) !important;
    }
    
    .display-6 {
        font-size: var(--text-xl) !important;
    }
    
    .card-body {
        padding: var(--space-lg);
    }
    
    .file-drop-area {
        padding: var(--space-xl) var(--space-lg);
    }
    
    .file-cards-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
        padding: var(--space-md);
    }
    
    .sticky-action-bar {
        padding: var(--space-md);
    }
    
    .sticky-action-bar .container {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .sticky-action-bar .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Hide back/cancel buttons on mobile sticky bar */
    .sticky-action-bar .btn-outline-secondary,
    .sticky-action-bar .btn-cancel {
        display: none !important;
    }
    
    .modal-dialog {
        margin: var(--space-md);
    }
    
    .modal-header,
    .modal-footer {
        padding: var(--space-md);
    }
    
    /* Step 3 action buttons */
    #step3 .row.g-4 > div {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    #step3 .row.g-4 .btn {
        width: 100%;
    }
}

/* ================================
   RESPONSIVE: MOBILE (max-width: 576px)
================================ */
@media (max-width: 576px) {
    :root {
        --text-2xl: 1.25rem;
        --text-3xl: 1.375rem;
        --text-4xl: 1.5rem;
    }
    
    .container {
        padding-left: var(--space-md);
        padding-right: var(--space-md);
    }
    
    .display-5 {
        font-size: var(--text-xl) !important;
        line-height: 1.3;
    }
    
    .display-6 {
        font-size: var(--text-lg) !important;
    }
    
    .fs-5 {
        font-size: var(--text-base) !important;
    }
    
    .card-body {
        padding: var(--space-lg) var(--space-md);
    }
    
    .file-drop-area {
        padding: var(--space-lg) var(--space-md);
    }
    
    .file-drop-area .rounded-circle {
        width: 40px !important;
        height: 40px !important;
    }
    
    .file-drop-area svg {
        width: 20px !important;
    }
    
    .btn-primary-custom,
    .btn-success-custom,
    .btn-confirm,
    .btn-cancel {
        padding: var(--space-md) var(--space-lg);
        font-size: var(--text-sm);
    }
    
    .file-summary-card {
        padding: var(--space-md);
    }
    
    .file-stats {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .navbar .container {
        padding-top: var(--space-sm);
        padding-bottom: var(--space-sm);
    }
    
    .navbar h1 {
        font-size: var(--text-base) !important;
    }
    
    .badge-step {
        font-size: var(--text-xs);
        padding: var(--space-xs) var(--space-sm);
    }
    
    /* Form controls */
    .form-select-lg {
        padding: var(--space-md);
        font-size: var(--text-base);
    }
    
    /* Stats cards in Step 3 */
    #step3 .row.g-4.mb-5 > div {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    /* Step indicator */
    .step-indicator {
        width: 36px;
        height: 36px;
        font-size: var(--text-base);
    }
    
    /* Main content padding */
    main.py-5 {
        padding-top: var(--space-xl) !important;
        padding-bottom: var(--space-xl) !important;
    }
    
    /* Heading spacing */
    .mb-5 {
        margin-bottom: var(--space-xl) !important;
    }
    
    /* Summary section adjustments */
    .summary-container {
        gap: var(--space-lg);
    }
}

/* ================================
   FOCUS VISIBLE STATES
================================ */
.btn:focus-visible,
.form-select:focus-visible,
.form-control:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ================================
   REDUCED MOTION
================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
