/**
 * Modal styles - All modal dialogs, popups, and overlays
 */

/* Modal Styles - Retro Flat */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: none;
}

/* Ensure proper centering for pushup popup modal */
.pushup-popup-modal {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    background-color: var(--bg-tertiary);
    margin: 5% auto;
    padding: 30px;
    border: 3px solid var(--border-color);
    border-radius: 0;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    text-align: center;
    box-shadow: none;
    font-family: var(--font-primary);
    box-sizing: border-box;
}

.modal h2 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-family: var(--font-heading);
    font-size: 1.2em;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 20px 0;
    text-align: center;
    width: 100%;
    line-height: 1.4;
}

.modal-icon {
    width: 24px;
    height: 24px;
    fill: var(--text-primary);
    flex-shrink: 0;
}

.modal-text {
    font-family: var(--font-primary);
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: 25px;
    line-height: 1.5;
    text-align: left;
}

.modal-text p {
    margin-bottom: 15px;
    line-height: 1.5;
}

.modal-text p:last-child {
    margin-bottom: 0;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
    flex-wrap: nowrap;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    font-family: Arial, sans-serif;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-close:focus {
    outline: none;
    color: var(--text-primary);
}

/* Push-up Challenge Modal Specific Styles */
.pushup-popup-modal .welcome-content {
    position: relative;
    background-color: var(--bg-tertiary);
    margin: 0;
    padding: 20px;
    border: 3px solid var(--border-color);
    border-radius: 0;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    text-align: center;
    box-shadow: none;
    box-sizing: border-box;
}

/* Settings Modal Styles */
.settings-modal .modal-content {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 0;
    padding: 30px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    position: relative;
    min-width: 400px;
    width: auto;
    margin: 5% auto;
}

.settings-modal-content {
    text-align: center;
}

.settings-modal h1 {
    font-family: var(--font-heading);
    font-size: 1.4em;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 25px;
    text-align: center;
}

.settings-modal .modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    font-family: Arial, sans-serif;
}

.settings-modal .modal-close:hover {
    color: var(--text-primary);
}

/* Save Canvas Info Modal Styles */
#saveCanvasInfoModal .modal-content {
    margin: 20vh auto !important;
    max-width: 450px !important; /* Increased width for more breathing room */
    padding: 24px !important; /* Increased padding for better spacing */
    min-height: auto !important; 
    height: auto !important;
    max-height: 280px !important; /* Reduced height to cut space below buttons */
    transform: scale(0.9) !important;
    
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    position: relative !important;
}

#saveCanvasInfoModal .modal-close {
    position: absolute !important;
    top: 10px !important;
    right: 15px !important;
    z-index: 10 !important;
}

#saveCanvasInfoModal h2 {
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    margin: 5px 0 10px 0 !important;
    padding: 0 30px 0 0 !important;
    line-height: 1.2 !important;
    width: 100% !important;
    font-size: 1.1em !important;
    position: relative !important;
}

#saveCanvasInfoModal .modal-text {
    margin: 5px 0 10px 0 !important;
    flex-grow: 0 !important;
    flex-shrink: 1 !important;
}

#saveCanvasInfoModal .modal-text p {
    margin: 8px 0 !important; /* Slightly more margin for breathing room */
    line-height: 1.5 !important; /* Better line height for readability */
    font-size: 0.95em !important; /* Slightly larger text */
}

#saveCanvasInfoModal .save-canvas-list {
    margin: 8px 0 !important;
    padding-left: 20px !important;
    font-size: 0.9em !important;
    line-height: 1.3 !important;
}

#saveCanvasInfoModal .save-canvas-list li {
    margin: 4px 0 !important;
    color: var(--text-secondary) !important;
}

#saveCanvasInfoModal .modal-text p:last-child {
    margin-bottom: 0 !important;
}

#saveCanvasInfoModal .modal-buttons {
    margin-top: 16px !important; /* Increased top margin for better spacing */
    margin-bottom: 0 !important;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
}

#saveCanvasInfoModal .btn {
    padding: 12px 24px !important;
    font-size: 0.9em !important;
}

/* Line Direction Info Modal - Compact Styling */
#lineDirectionInfoModal .modal-content {
    margin: 20vh auto !important;
    max-width: 450px !important; /* Increased width for more breathing room */
    padding: 24px !important; /* Increased padding for better spacing */
    min-height: auto !important; 
    height: auto !important;
    max-height: 280px !important;
    transform: scale(0.9) !important;
    
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    position: relative !important;
}

#lineDirectionInfoModal .modal-close {
    position: absolute !important;
    top: 10px !important;
    right: 15px !important;
    z-index: 10 !important;
}

#lineDirectionInfoModal h2 {
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    margin: 5px 0 10px 0 !important;
    padding: 0 30px 0 0 !important;
    line-height: 1.2 !important;
    width: 100% !important;
    font-size: 1.1em !important;
    position: relative !important;
}

#lineDirectionInfoModal .modal-text {
    margin: 5px 0 10px 0 !important;
    flex-grow: 0 !important;
    flex-shrink: 1 !important;
}

#lineDirectionInfoModal .modal-text p {
    margin: 8px 0 !important; /* Slightly more margin for breathing room */
    line-height: 1.5 !important; /* Better line height for readability */
    font-size: 0.95em !important; /* Slightly larger text */
}

#lineDirectionInfoModal .modal-text p:last-child {
    margin-bottom: 0 !important;
}

#lineDirectionInfoModal .modal-buttons {
    margin-top: 16px !important; /* Increased top margin for better spacing */
    margin-bottom: 0 !important;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
}

#lineDirectionInfoModal .btn {
    padding: 12px 24px !important;
    font-size: 0.9em !important;
}

/* Old line info popup styles removed - now using fixed panel in sidebar */

/* Responsive Modal Design */
@media (max-width: 768px) {
    .modal-buttons {
        flex-direction: column;
        gap: 10px;
        flex-wrap: nowrap;
    }
    
    .modal-buttons .btn {
        width: auto !important;
        min-width: 160px !important;
        min-height: 48px;
        height: auto;
        max-width: 280px !important;
        font-size: 0.85em !important;
    }
}

@media (max-width: 480px) {
    .modal-content {
        margin: 10% auto;
        padding: 20px;
    }
    
    /* Old popup responsive styles removed */
    
    .settings-modal .modal-content {
        min-width: 0;
        width: 95%;
        padding: 15px;
        margin: 5px auto;
    }
    
    .settings-modal h1 {
        font-size: 1.3em;
    }
    
    .modal-buttons .btn {
        font-size: 0.8em !important;
        max-width: 240px !important;
    }
}
