/* Modal.css - Dedicated styles for modal components including settings modal */
/* This file contains all modal-related styling for the Pixel Audio Studio application */

/* ============================================= */
/* 1. MODAL OVERLAY - Full screen backdrop */
/* ============================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-overlay.open {
    display: flex;
}

/* ============================================= */
/* 2. MODAL STRUCTURE - Base modal container */
/* ============================================= */
.modal {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    width: 400px;
    max-width: 90%;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    padding: 20px;
    position: relative;
}

/* Make modal wider to accommodate four tabs */
.modal-overlay .modal {
    width: 500px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

/* ============================================= */
/* 3. MODAL HEADER - Title and subtitle area */
/* ============================================= */
.modal-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    color: var(--accent-primary);
    font-size: 1.2rem;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Fix header vertical alignment - using exact pixelTilemaps styles */
.modal header {
    flex-shrink: 0;
    padding: 0px 20px 50px 20px;
    width: 100%;
    display: block;
    margin-bottom: 40px;
}

/* Modal title styling */
.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #a855f7;
}

.modal-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
    margin-bottom: 15px;
}

/* ============================================= */
/* 4. MODAL CLOSE BUTTON - Top right close button */
/* ============================================= */
.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    color: var(--accent-secondary);
    background: rgba(255, 0, 110, 0.1);
}

/* ============================================= */
/* 5. MODAL CONTENT - Scrollable content area */
/* ============================================= */
.modal-content {
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 10px;
    margin-right: -10px;
}

/* ============================================= */
/* 6. MODAL CONTENT WRAPPER - Main content container */
/* ============================================= */
.modal-content-wrapper {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    max-height: 50vh;
    padding: 25px 20px 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) var(--bg-dark);
    display: flex;
    flex-direction: column;
}

/* ============================================= */
/* 7. MODAL SCROLLBAR STYLING - Custom scrollbar design */
/* ============================================= */
.modal-content-wrapper::-webkit-scrollbar {
    width: 8px;
}

.modal-content-wrapper::-webkit-scrollbar-track {
    background: var(--bg-dark);
    border-radius: 4px;
}

.modal-content-wrapper::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
}

.modal-content-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

/* ============================================= */
/* 8. MODAL ACTIONS - Footer button area */
/* ============================================= */
.modal-actions {
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
    margin-top: 15px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.modal-actions .btn {
    min-width: 100px;
}
/* ============================================= */
/* 9. KEYBOARD SHORTCUTS MODAL - Specific styles for shortcuts display */
/* ============================================= */
.shortcut-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin: 15px 0;
}

.shortcut-item {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    transition: all 0.2s ease;
}

.shortcut-item:hover {
    background: var(--bg-medium);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.shortcut-key {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--accent-primary);
    background: rgba(168, 85, 247, 0.1);
    padding: 6px 10px;
    border-radius: 4px;
    margin-bottom: 8px;
    display: inline-block;
    min-width: 40px;
}

.shortcut-description {
    font-size: 0.8rem;
    color: var(--text-primary);
    line-height: 1.2;
}

/* Settings tab content for keyboard shortcuts */
#shortcuts-tools .settings-section,
#shortcuts-general .settings-section,
#shortcuts-navigation .settings-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

#shortcuts-tools .settings-section:last-child,
#shortcuts-general .settings-section:last-child,
#shortcuts-navigation .settings-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

/* Wider modal for keyboard shortcuts */
#keyboard-shortcuts-modal .modal {
    width: 600px;
    max-width: 90%;
}

/* Print styles for keyboard shortcuts */
@media print {
    #keyboard-shortcuts-modal {
        display: block !important;
    }

    #keyboard-shortcuts-modal .modal {
        width: 100%;
        max-width: 100%;
        box-shadow: none;
        border: none;
    }

    .shortcut-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}
