/*
 * dialog-base.css
 *
 * Base styles for all modal dialogs in the Voice Flipper application.
 * Uses the db- prefix to avoid conflicts with existing dialog-specific styles.
 */

/* *******************************************************
 * Overlay
 * ******************************************************* */

.db-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

/* *******************************************************
 * Dialog container variants
 * ******************************************************* */

.db-dialog {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.db-dialog-sm {
    max-width: 400px;
}

.db-dialog-wide {
    max-width: 700px;
}

.db-dialog-fullscreen {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 12px;
}

/* *******************************************************
 * Header
 * ******************************************************* */

.db-header {
    --db-header-color1: #667eea;
    --db-header-color2: #764ba2;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(135deg, var(--db-header-color1) 0%, var(--db-header-color2) 100%);
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.db-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    flex: 1;
}

/* Count/badge indicators inside the gradient header */
.db-header .voice-count-indicator,
.db-header .flip-count-indicator {
    background: rgba(255, 255, 255, 0.25) !important;
    background-color: rgba(255, 255, 255, 0.25) !important;
    box-shadow: none !important;
    color: white !important;
    flex-shrink: 0;
}

.db-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.db-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* *******************************************************
 * Body
 * ******************************************************* */

.db-body {
    padding: 20px 24px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* *******************************************************
 * Footer with status bar
 * ******************************************************* */

.db-footer {
    flex-shrink: 0;
    height: 42px;
    border-top: 2px solid #555;
    border-radius: 0 0 12px 12px;
    display: flex;
    align-items: stretch;
    overflow: hidden;
}

.db-footer .db-status {
    flex: 1;
    padding: 10px;
    margin: 0;
    background: #d1ecf1;
    color: #0c5460;
    border-radius: 0;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.db-footer .db-status.error {
    background: #f8d7da;
    color: #721c24;
}

.db-footer .db-status.success {
    background: #d4edda;
    color: #155724;
}

.db-footer .db-status.info {
    background: #d1ecf1;
    color: #0c5460;
}

/* *******************************************************
 * Buttons
 * ******************************************************* */

.db-btn {
    padding: 10px 24px;
    border-radius: 6px;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 90px;
}

.db-btn-primary {
    background: #007bff;
    color: white;
}

.db-btn-primary:hover:not(:disabled) {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.db-btn-secondary {
    background: white;
    color: #6c757d;
    border: 2px solid #6c757d;
}

.db-btn-secondary:hover:not(:disabled) {
    background: #6c757d;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.db-btn-danger {
    background: #dc3545;
    color: white;
}

.db-btn-danger:hover:not(:disabled) {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.db-btn:active:not(:disabled) {
    transform: translateY(0);
}

.db-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.db-btn-container {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* *******************************************************
 * Form elements
 * ******************************************************* */

.db-form-group {
    margin-bottom: 16px;
}

.db-form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.db-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95rem;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

.db-input:focus {
    outline: none;
    border-color: #667eea;
}

.db-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
    resize: vertical;
}

.db-textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* *******************************************************
 * Responsive — mobile phones: all dialogs go full screen
 * ******************************************************* */

@media (max-width: 600px) {
    /* Prevent horizontal page scroll */
    body {
        overflow-x: hidden;
    }

    /* All overlays: fill the screen with no padding, stretch child to full height */
    .db-overlay,
    .modal-overlay,
    .mv-modal-overlay,
    .mf-modal-overlay,
    .mau-modal-overlay,
    .mua-modal-overlay,
    .cpw-modal-overlay,
    .fpw-modal-overlay,
    .df-modal-overlay,
    .sf-modal-overlay,
    .managepron-modal-overlay,
    .changelog-modal-overlay,
    .managetemplates-modal-overlay,
    .testemail-modal-overlay,
    .mav-modal-overlay,
    .tos-overlay {
        padding: 0;
        align-items: stretch;
    }

    /* All dialog containers: full screen */
    .db-dialog,
    .db-dialog-sm,
    .db-dialog-wide,
    .modal-dialog,
    .mv-modal-dialog,
    .mv-modal-dialog-small,
    .mf-modal-dialog,
    .mf-modal-dialog-small,
    .mau-modal-dialog,
    .mau-modal-dialog-small,
    .mua-modal-dialog,
    .cpw-modal-dialog,
    .fpw-modal-dialog,
    .df-modal-dialog,
    .sf-modal-dialog,
    .managepron-modal-dialog,
    .changelog-modal-dialog,
    .managetemplates-modal-dialog,
    .testemail-modal-dialog,
    .mav-modal-dialog,
    .tos-dialog {
        max-width: 100%;
        width: 100%;
        max-height: 100dvh;
        height: 100dvh;
        border-radius: 0;
        margin: 0;
    }

    /* Remove rounded corners from header/footer to match full-screen edges */
    .db-header {
        border-radius: 0;
    }

    .db-footer {
        border-radius: 0;
    }

    /* Button layout */
    .db-btn-container {
        flex-direction: column;
        gap: 10px;
    }

    .db-btn {
        width: 100%;
        min-width: unset;
    }
}
