/* Garage Page Styles - Based on garage.html design */
/* This file contains styles specific to the Garage Index page */

/* CSS Variables - Use same as main.css to match dashboard */
:root {
    --primary-red: rgba(122, 1, 21, 1);
    --primary-red-dark: rgba(115, 1, 20, 1);
    --primary-red-light: rgba(252, 234, 234, 1);
    --gray-light: rgba(237, 237, 237, 1);
    --gray-normal: rgba(70, 72, 74, 1);
    --gray-dark: rgba(53, 54, 56, 1);
    --gray-darker: rgba(25, 25, 26, 1);
    --text-primary: rgba(25, 25, 26, 1);
    --text-secondary: rgba(159, 162, 190, 1);
    --white: #ffffff;
    --shadow: 0px 0px 25px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0px 10px 30px rgba(0, 0, 0, 0.15);
    --border-radius: 10px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Ensure content-wrapper has proper spacing */
.content-wrapper {
    padding: 32px;
    background-color: #F9FAFB;
}

/* Status badge for approval status */
.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
    display: inline-block;
}

.status-badge.pending {
    background-color: rgba(245, 158, 11, 0.1);
    color: #92400E;
    border: 1px solid #F59E0B;
}

.status-badge.rejected,
.status-badge.denied {
    background-color: rgba(239, 68, 68, 0.1);
    color: #991B1B;
    border: 1px solid #EF4444;
}

.status-badge.approved {
    background-color: rgba(16, 185, 129, 0.1);
    color: #065F46;
    border: 1px solid #10B981;
}

.status-badge.active {
    background-color: rgba(16, 185, 129, 0.1);
    color: #065F46;
    border: 1px solid #10B981;
}

.status-badge.maintenance {
    background-color: rgba(245, 158, 11, 0.1);
    color: #92400E;
    border: 1px solid #F59E0B;
}

.status-badge.vacant {
    background-color: rgba(156, 163, 175, 0.1);
    color: #374151;
    border: 1px solid #9CA3AF;
}

/* Stats Grid */
.content-wrapper .stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 48px;
}

.content-wrapper .stats-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.content-wrapper .stats-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.content-wrapper .stats-card.primary {
    background: linear-gradient(135deg, var(--gray-normal) 0%, var(--gray-dark) 100%);
    color: var(--white);
}

.content-wrapper .stats-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-red-light);
    color: var(--primary-red);
    font-size: 24px;
    flex-shrink: 0;
}

.content-wrapper .stats-card.primary .stats-icon {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.content-wrapper .stats-content {
    flex: 1;
}

.content-wrapper .stats-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    opacity: 0.8;
}

.content-wrapper .stats-value {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 4px;
}

.content-wrapper .stats-subtitle {
    font-size: 12px;
    font-weight: 500;
}

.content-wrapper .stats-subtitle.positive {
    color: #10B981;
}

.content-wrapper .stats-card.primary .stats-subtitle:not(.positive) {
    color: rgba(255, 255, 255, 0.8);
}

/* Content Grid */
.content-grid {
    display: flex;
    gap: 32px;
}

.content-main {
    flex: 1;
}

.content-sidebar {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* Table Styles */
.table-container {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 32px;
    border: 1px solid #E5E7EB;
    overflow-x: auto;
    max-width: 100%;
}

.garage-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

/* Override main.css .dashboard .table-header for garage table */
.garage-table thead th.table-header,
.table-container .garage-table thead th.table-header,
.dashboard .garage-table thead th.table-header,
.garage-table th.table-header {
    background-color: var(--primary-red) !important;
    color: var(--white) !important;
    padding: 16px 20px !important;
    text-align: left !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    display: table-cell !important;
    justify-content: unset !important;
    align-items: unset !important;
    margin-bottom: 0 !important;
    border: none !important;
}

.table-header-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Override main.css grid display for garage table rows */
.garage-table .table-row,
.table-container .garage-table .table-row,
.dashboard .garage-table .table-row,
.garage-table tbody tr.table-row {
    display: table-row !important;
    border-bottom: 1px solid #E5E7EB;
    transition: var(--transition);
}

.garage-table .table-row:last-child,
.table-container .garage-table .table-row:last-child,
.dashboard .garage-table .table-row:last-child {
    border-bottom: none;
}

.garage-table .table-row:hover,
.table-container .garage-table .table-row:hover,
.dashboard .garage-table .table-row:hover {
    background-color: var(--gray-light);
}

.table-row {
    border-bottom: 1px solid #E5E7EB;
    transition: var(--transition);
}

.table-row:last-child {
    border-bottom: none;
}

.table-row:hover {
    background-color: var(--gray-light);
}

.table-cell {
    padding: 16px 20px;
    font-size: 14px;
    color: var(--text-primary);
    text-align: left;
    vertical-align: middle;
}

.nu-cell {
    font-weight: 600;
    color: var(--primary-red);
    width: 60px;
}

.garage-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.garage-type {
    font-size: 12px;
    color: var(--text-secondary);
    background-color: var(--gray-light);
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

.location-cell {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.location-cell i {
    color: var(--primary-red);
    font-size: 16px;
}

.capacity-cell {
    font-weight: 600;
    color: var(--gray-darker);
}

.occupied-cell {
    width: 150px;
    white-space: normal;
    /* Allow progress bar to display */
}

.occupied-progress {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background-color: var(--gray-light);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-red), var(--primary-red-dark));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.occupied-text {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

.image-cell {
    width: 100px;
}

.garage-thumbnail {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #E5E7EB;
    background: var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-cell {
    width: 150px;
}

.settings-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    background: none;
    color: var(--text-secondary);
}

.edit-btn {
    background-color: rgba(59, 130, 246, 0.1);
    color: #3B82F6;
}

.edit-btn:hover {
    background-color: #3B82F6;
    color: white;
    transform: translateY(-2px);
}

.delete-btn {
    background-color: rgba(239, 68, 68, 0.1);
    color: #EF4444;
}

.delete-btn:hover {
    background-color: #EF4444;
    color: white;
    transform: translateY(-2px);
}

.view-btn {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10B981;
}

.view-btn:hover {
    background-color: #10B981;
    color: white;
    transform: translateY(-2px);
}

.approve-btn {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10B981;
}

.approve-btn:hover {
    background-color: #10B981;
    color: white;
    transform: translateY(-2px);
}

.reject-btn {
    background-color: rgba(239, 68, 68, 0.1);
    color: #EF4444;
}

.reject-btn:hover {
    background-color: #EF4444;
    color: white;
    transform: translateY(-2px);
}

/* Add Garage Button */
.add-garage-btn {
    background-color: var(--primary-red);
    color: var(--white);
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
}

.add-garage-btn:hover {
    background-color: var(--primary-red-dark);
    transform: translateY(-2px);
}

/* Progress Charts */
.progress-chart {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    border: 1px solid #E5E7EB;
}

.chart-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 24px;
}

.chart-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.completion-chart {
    width: 150px;
    height: 150px;
}

.chart-percentage {
    font-size: 24px;
    font-weight: 600;
    fill: var(--text-primary);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-container {
    background: var(--white);
    border-radius: 12px;
    width: 850px;
    /* Slightly wider to accommodate new tabs comfortably */
    max-width: 95%;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Header/Footer fixed, Body scrolls */
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(122, 1, 21, 0.1);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-15px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--primary-red);
    color: var(--white);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--white);
}

.close-modal {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: var(--white);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

.modal-body {
    width: 100%;
    flex: 1;
    overflow-y: auto;
    padding: 0;
    /* Let content handle padding */
}

/* Step Progress */
.modal-step-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--gray-light);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    gap: 10px;
}

.step-progress-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    flex: 1;
}

.step-progress-item:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 12px;
    right: calc(50% + 15px);
    left: calc(50% - 15px);
    height: 2px;
    background: var(--gray-normal);
    z-index: 1;
}

.step-progress-item.active:not(:last-child)::after {
    background: var(--primary-red);
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gray-normal);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
}

.step-progress-item.active .step-number {
    background: var(--primary-red);
    transform: scale(1.05);
}

.step-progress-item.completed .step-number {
    background: var(--primary-red);
}

.step-progress-item.completed .step-number::after {
    content: '✓';
}

.step-name {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.step-progress-item.active .step-name {
    color: var(--primary-red);
    font-weight: 600;
}

/* Modal Actions - Add & Cancel buttons with icons */
.modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--gray-light);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    gap: 12px;
}

.modal-add-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.add-required-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    color: var(--primary-red);
    cursor: help;
    font-size: 18px;
    line-height: 1;
    border-radius: 50%;
    transition: opacity 0.2s ease;
}

.add-required-hint:hover {
    opacity: 0.85;
}

.add-required-hint i {
    font-size: 1.15rem;
}

.modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
    min-width: 130px;
}

.modal-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
}

.modal-btn-icon i {
    font-size: 1.125rem;
}

.modal-btn-text {
    white-space: nowrap;
}

/* Add - primary action (left) */
.modal-btn-add {
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--primary-red-dark) 100%);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(122, 1, 21, 0.25);
}

.modal-btn-add:hover:not(:disabled) {
    background: var(--primary-red-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(122, 1, 21, 0.35);
}

.modal-btn-add:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* عند اكتمال كل المطلوب: الزر يصير أخضر (active) */
.modal-btn-add.modal-btn-add--active:not(:disabled) {
    background: linear-gradient(135deg, #0d7a3d 0%, #0a5c2e 100%);
    box-shadow: 0 2px 8px rgba(13, 122, 61, 0.3);
}

.modal-btn-add.modal-btn-add--active:not(:disabled):hover {
    background: #0a5c2e;
    box-shadow: 0 4px 14px rgba(13, 122, 61, 0.4);
}

/* Cancel - secondary (right) */
.modal-btn-cancel {
    background: var(--gray-normal);
    color: var(--white);
}

.modal-btn-cancel:hover {
    background: var(--gray-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Submit - when form is ready */
.modal-btn-submit {
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--primary-red-dark) 100%);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(122, 1, 21, 0.25);
}

.modal-btn-submit:hover {
    background: var(--primary-red-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(122, 1, 21, 0.35);
}

/* Form Controls */
.gps-input-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gps-input {
    flex: 1;
}

.gps-separator {
    font-weight: bold;
    color: var(--text-secondary);
}

.hours-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.hours-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.time-input {
    padding: 12px;
    font-size: 14px;
}

.status-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 8px;
}

.status-option {
    border: 2px solid var(--gray-light);
    border-radius: var(--border-radius);
    padding: 12px 15px;
    cursor: pointer;
    transition: var(--transition);
    background: var(--white);
    text-align: center;
    position: relative;
    font-size: 13px;
}

.status-option:hover {
    border-color: var(--primary-red);
    background: var(--primary-red-light);
}

.status-option.selected {
    border-color: var(--primary-red);
    background: var(--primary-red-light);
    color: var(--primary-red);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .content-wrapper .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .content-grid {
        flex-direction: column;
    }

    .content-sidebar {
        width: 100%;
        flex-direction: row;
    }

    .progress-chart {
        flex: 1;
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        padding: 16px;
    }

    .content-wrapper .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .content-wrapper .table-container {
        margin-bottom: 24px;
    }

    .content-wrapper .table-cell {
        padding: 12px 16px;
    }

    .content-wrapper .settings-actions {
        flex-direction: column;
        gap: 4px;
    }

    .content-wrapper .action-btn {
        width: 32px;
        height: 32px;
    }

    .section-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .add-garage-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .content-wrapper .stats-card {
        padding: 16px;
    }

    .content-wrapper .stats-value {
        font-size: 24px;
    }

    .modal-container {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-overlay {
        padding: 0;
    }

    .modal-header {
        padding: 10px 12px;
    }

    .step-progress-item:not(:last-child)::after {
        display: none;
    }

    .step-name {
        display: none;
    }

    .status-options {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar Styling */
.content-wrapper::-webkit-scrollbar {
    width: 8px;
}

.content-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.content-wrapper::-webkit-scrollbar-thumb {
    background: var(--primary-red);
    border-radius: 4px;
}

.content-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--primary-red-dark);
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--primary-red);
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--primary-red-dark);
}

/* Focus States for Accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary-red);
    outline-offset: 2px;
}

/* Loading Spinner */
.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #E5E7EB;
    border-top-color: #7A0115;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}