/**
 * Modal Component Styles
 * 
 * Purpose: Provides styling for modal dialogs including overlay, content area, and animations
 * Used by: Job summary modal and other modal dialogs
 */

/* Clickable table rows (for job list) */
table tbody tr.clickable {
    cursor: pointer;
}

/* Modal Container */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-in-out;
}

.modal[hidden] {
    display: none;
}

/* Modal Overlay (darkened background) */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

/* Modal Content Box */
.modal-content {
    position: relative;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

/* Modal Header */
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #333333;
}

/* Modal Close Button */
.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: #666666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.modal-close:hover {
    background-color: #f5f5f5;
    color: #333333;
}

.modal-close:active {
    background-color: #e0e0e0;
}

/* Modal Body */
.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-body p {
    margin: 0 0 12px 0;
}

/* Modal Footer */
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Download Controls */
.download-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-right: auto;
}

.download-buttons {
    display: flex;
    gap: 4px;
}

.format-dropdown {
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 1rem;
    background-color: #ffffff;
    cursor: pointer;
    min-width: 180px;
}

/* Button Styles for Modal */
.modal-footer button {
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
    transform: none;
}

.modal-footer button:active:not(:disabled) {
    transform: none;
}

.modal-footer button:disabled,
.modal-footer button[disabled] {
    cursor: not-allowed;
    transform: none;
    transition: background-color 0.2s ease, transform 0s ease;
}

.btn-primary {
    background-color: #2196f3;
    color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
    background-color: #1976d2;
}

.btn-secondary {
    background-color: #f5f5f5;
    color: #333333;
    border: 1px solid #e0e0e0;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #e0e0e0;
}

.btn-icon {
    width: 16px;
    height: 16px;
}

/* Options Modal Content */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.option-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
}

.option-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.option-button .btn-icon {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-header {
        padding: 16px 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-footer {
        padding: 12px 20px;
        flex-direction: column;
    }

    .modal-footer button {
        width: 100%;
        justify-content: center;
    }

    .summary-field {
        flex-direction: column;
    }

    .summary-field-label {
        min-width: auto;
        margin-bottom: 4px;
    }
}

/* Dark mode support (placed after base styles for correct override) */
@media (prefers-color-scheme: dark) {
    .modal-content {
        background-color: #121212;
        box-shadow: 0 6px 24px rgba(0, 0, 0, 0.85);
        border: 1px solid #1f1f1f;
    }

    .modal-header {
        border-bottom: 1px solid #2a2a2a;
    }

    .modal-header h3 {
        color: #f0f0f0;
    }

    .modal-body {
        color: #e0e0e0;
    }

    .modal-close {
        color: #c0c0c0;
    }
    .modal-close:hover {
        background-color: #1e1e1e;
        color: #ffffff;
    }
    .modal-close:active {
        background-color: #292929;
    }
    .modal-close:focus-visible {
        outline: 2px solid #2196f3;
        outline-offset: 2px;
    }

    .modal-footer {
        border-top: 1px solid #2a2a2a;
        background-color: #121212;
    }

    .btn-primary {
        background-color: #0d6efd;
    }
    .btn-primary:hover:not(:disabled) {
        background-color: #0b5ed7;
    }
    .btn-primary:focus-visible {
        outline: 2px solid #ffffff;
        outline-offset: 2px;
    }

    .btn-secondary {
        background-color: #1e1e1e;
        color: #e0e0e0;
        border: 1px solid #303030;
    }
    .btn-secondary:hover:not(:disabled) {
        background-color: #262626;
    }
    .btn-secondary:focus-visible {
        outline: 2px solid #ffffff;
        outline-offset: 2px;
    }

    .format-dropdown {
        background-color: #1e1e1e;
        color: #e0e0e0;
        border: 1px solid #303030;
    }
    .format-dropdown:hover {
        background-color: #262626;
    }
    .format-dropdown:focus {
        outline: 2px solid #2196f3;
        outline-offset: 2px;
    }

    /* Options modal content in dark mode */
    .option-button {
        background: #1e1e1e;
        border: 1px solid #303030;
        color: #e0e0e0;
    }

    .option-button:hover {
        background: #262626;
        border-color: #404040;
    }
}
