/* Voice Recording Dialog Stylesheet */

/* Modal Dialog */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-dialog {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp 0.3s ease;
}

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

/* Drag and drop visual feedback */
.modal-dialog.drag-over {
    border: 3px dashed #667eea;
    background: #f0f4ff;
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.4);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px 25px;
    border-bottom: 2px solid #e0e0e0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    color: #333;
    flex: 1;
}

/* Voice Count Indicator */
.voice-count-indicator {
    display: inline-block;
    flex-shrink: 0;
    background-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
    transition: background 0.3s ease, box-shadow 0.3s ease;
    min-width: 50px;
    text-align: center;
}

.voice-count-indicator.at-limit {
    background-color: #dc3545;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.4);
}

/* Voice Limit Warning */
.voice-limit-warning {
    display: none;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    padding: 30px 25px;
    border-radius: 8px;
    text-align: center;
    margin: 20px 0;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.voice-limit-warning.visible {
    display: block;
}

.voice-limit-warning-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.voice-limit-warning-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.voice-limit-warning-message {
    font-size: 0.95rem;
    line-height: 1.5;
    opacity: 0.95;
}

/* Hide normal content when at limit */
.modal-body-content.hidden-at-limit {
    display: none;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f5f5f5;
    color: #666;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

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

.modal-body {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
}

/* Permanent footer — always rendered, fixed height, never scrolls away */
.vr-modal-footer {
    flex-shrink: 0;
    height: 42px;
    border-top: 2px solid #555;
    border-radius: 0 0 12px 12px;
    display: flex;
    align-items: stretch;
    overflow: hidden;
}

/* Status fills the full footer area */
.vr-modal-footer .dialog-status {
    flex: 1;
    padding: 10px 25px;
    margin: 0;
    background: #d1ecf1;
    color: #0c5460;
    border-radius: 0;
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
}

.vr-modal-footer .dialog-status.error {
    background: #f8d7da;
    color: #721c24;
}

.vr-modal-footer .dialog-status.success {
    background: #d4edda;
    color: #155724;
}

/* Controls */
.controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 0.95rem;
    color: #333;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-label span {
    font-weight: 500;
}

/* Modal Playback Widget */
.modal-playback-widget {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 15px;
    border: 1px solid #e0e0e0;
}

.modal-playback-widget.ghosted {
    opacity: 1;
}

.modal-playback-widget.ghosted > *:not(.waveform-visualization-buttons-container):not(.waveform-controls-row) {
    opacity: 0.3;
}


.modal-playback-widget .playback-controls {
    display: flex;
    flex-direction: row;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

/* Progress Container */
.progress-container {
    margin-top: 10px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 8px;
}

.progress-label {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 6px;
    text-align: center;
}

.progress-bar-outer {
    width: 100%;
    height: 24px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Playback Buttons */
.playback-btn {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    border: 1px solid #d0d0d0;
    background: #e8e8e8;
    color: #000000;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 2px;
}

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

.playback-btn:active:not(:disabled) {
    transform: translateY(0);
    background: #c8c8c8;
}

.playback-btn:disabled {
    background: #e8e8e8;
    color: #b0b0b0;
    cursor: not-allowed;
    opacity: 0.5;
    border-color: #e0e0e0;
}

/* Add spacing for double-character icons */
.playback-btn.skip {
    letter-spacing: 3px;
    font-size: 20px;
}

/* Pause button specific styling */
.playback-btn.pause {
    letter-spacing: 3px;
    font-size: 20px;
}

/* Record button specific styling */
#modalMicButton {
    color: #dc3545;
    font-size: 24px;
    padding: 8px;
}

#modalMicButton.recording {
    color: #000000;
    font-size: 24px;
}

/* Waveform Visualization Buttons Widget */
.waveform-visualization-buttons-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.waveform-visualization-buttons-left {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0px;
    flex: 1;
}

.waveform-visualization-buttons-right {
    display: flex;
    align-items: center;
}

.waveform-visualization-button {
    cursor: pointer;
    width: 40px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    pointer-events: auto;
    position: relative;
    z-index: 10;
}

.waveform-visualization-button-svg {
    width: 100%;
    height: 100%;
    display: block;
    margin: 0;
    padding: 0;
    pointer-events: none;
}

.waveform-visualization-button-svg * {
    pointer-events: none;
}

.waveform-visualization-button-icon {
    transition: transform 0.2s ease;
}

.waveform-visualization-button-icon-record {
    transform-origin: 21px 18px;
}

.waveform-visualization-button-icon-recordstop {
    transform-origin: 21px 18px;
}

.waveform-visualization-button-icon-play {
    transform-origin: 57px 18px;
}

.waveform-visualization-button-icon-pause {
    transform-origin: 57px 18px;
}

.waveform-visualization-button-icon-stop {
    transform-origin: 92px 18px;
}

.waveform-visualization-button-icon-skip {
    transform-origin: 129px 18px;
}

.waveform-visualization-button:hover .waveform-visualization-button-icon {
    transform: scale(1.2);
}

.waveform-visualization-button:active .waveform-visualization-button-icon {
    transform: scale(0.9);
}

/* Ghosted state for disabled waveform visualization buttons */
.waveform-visualization-button-ghosted {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.waveform-visualization-button-ghosted:hover .waveform-visualization-button-icon {
    transform: scale(1);
}

/* Waveform Controls Row (buttons + upload) */
.waveform-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.upload-button {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.upload-button-svg {
    width: 100%;
    height: 100%;
}

.upload-button-icon {
    transition: transform 0.2s ease;
    transform-origin: 18px 18px;
}

.upload-button:hover .upload-button-icon {
    transform: scale(1.1);
}

.upload-button:active .upload-button-icon {
    transform: scale(0.95);
}

/* Ghosted state for upload button */
.upload-button-ghosted {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.upload-button-ghosted:hover .upload-button-icon {
    transform: scale(1);
}

/* Processing Status Message Box */
.processing-status-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    padding: 12px 16px;
    background: #e3f2fd;
    border-radius: 8px;
    border: 1px solid #bbdefb;
}

.processing-message {
    color: #1976d2;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
}

.processing-spinner {
    width: 18px;
    height: 18px;
    border: 3px solid #bbdefb;
    border-top-color: #1976d2;
    border-radius: 50%;
    animation: processingSpinnerSpin 0.8s linear infinite;
    flex-shrink: 0;
}

.processing-spinner.hidden {
    display: none;
}

@keyframes processingSpinnerSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Save section (voice name + description + save button) */
.vr-save-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.vr-description-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
    resize: vertical;
    min-height: 60px;
}

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

.vr-save-button-row {
    display: flex;
    justify-content: center;
}

.vr-save-section input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    flex: none;
}

input[type="text"] {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

.save-button {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    background: #007bff;
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.save-button:hover:not(:disabled) {
    background: #0056b3;
}

.save-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Mobile/Phone Responsive Layout */
@media (max-width: 600px) {
    .modal-overlay {
        padding: 0;
        align-items: stretch;
    }

    .modal-dialog {
        margin: 0;
        max-width: 100%;
        width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }

    .modal-header {
        padding: 15px 20px;
        flex-shrink: 0;
    }

    .modal-header h2 {
        font-size: 1.2rem;
    }

    .modal-body {
        padding: 20px;
        min-height: 0;
    }

    .vr-modal-footer {
        border-radius: 0;
    }

    /* Make interactive elements touch-friendly */
    .modal-playback-widget {
        padding: 12px;
        gap: 10px;
    }

    .playback-btn {
        width: 48px;
        height: 48px;
        font-size: 30px;
    }

    .playback-btn.skip,
    .playback-btn.pause {
        font-size: 22px;
    }

    /* Checkbox controls */
    .controls {
        gap: 12px;
        flex-wrap: wrap;
    }

    .checkbox-label {
        font-size: 0.9rem;
    }

    .checkbox-label input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }

    /* Progress container */
    .progress-container {
        padding: 8px;
    }

    .progress-label {
        font-size: 0.75rem;
    }

    .progress-bar-outer {
        height: 20px;
    }

    .progress-bar-inner {
        font-size: 0.7rem;
    }

    /* Input and buttons */
    input[type="text"] {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
    }

    .save-button {
        padding: 12px 18px;
        font-size: 0.95rem;
        min-height: 48px;
    }

    .upload-button {
        width: 44px;
        height: 44px;
    }

    /* Waveform visualization buttons */
    .waveform-visualization-button {
        width: 44px;
        height: 40px;
    }

    /* Processing status box */
    .processing-status-box {
        padding: 10px 14px;
        margin-top: 12px;
    }

    .processing-message {
        font-size: 0.9rem;
    }

    .processing-spinner {
        width: 16px;
        height: 16px;
    }

    /* Ensure modal close button is touch-friendly */
    .modal-close {
        width: 36px;
        height: 36px;
        font-size: 1.6rem;
    }
}
