/* Trim Modal Styles */

/* Wider modal for waveform */
.modal-trim {
    max-width: 800px;
    width: 95%;
}

.modal-trim .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-close-trim {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.btn-close-trim:hover {
    color: #333;
}

body.dark-mode .btn-close-trim {
    color: #999;
}

body.dark-mode .btn-close-trim:hover {
    color: #fff;
}

/* Recording info */
.trim-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 5px;
}

body.dark-mode .trim-info {
    background: #333;
}

.trim-info strong {
    font-size: 16px;
    color: #333;
}

body.dark-mode .trim-info strong {
    color: #e0e0e0;
}

.trim-info span {
    font-size: 14px;
    color: #666;
}

body.dark-mode .trim-info span {
    color: #999;
}

/* Waveform container */
#trim-waveform-container {
    position: relative;
    background: #f0f0f0;
    border-radius: 8px;
    margin-bottom: 15px;
    min-height: 128px;
    overflow: hidden;
}

body.dark-mode #trim-waveform-container {
    background: #1a1a1a;
}

#trim-waveform {
    width: 100%;
}

/* Clip lines — the waveform is drawn at true scale, so audio that reaches
   these top/bottom lines will clip (distort) once saved. */
.trim-clip-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(231, 76, 60, 0.65);
    pointer-events: none;
    z-index: 3;
}

.trim-clip-top {
    top: 0;
}

.trim-clip-bottom {
    top: 126px;
}

.trim-clip-line span {
    position: absolute;
    right: 6px;
    top: 3px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #e74c3c;
}

#trim-waveform-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-size: 14px;
}

body.dark-mode #trim-waveform-loading {
    color: #999;
}

/* Current position indicator */
#trim-current-position {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    background: rgba(231, 76, 60, 0.1);
    border-top: 1px solid rgba(231, 76, 60, 0.3);
}

body.dark-mode #trim-current-position {
    background: rgba(231, 76, 60, 0.15);
    border-top-color: rgba(231, 76, 60, 0.4);
}

#trim-current-position .position-label {
    font-size: 12px;
    color: #e74c3c;
    font-weight: 500;
}

#trim-current-position .position-value {
    font-size: 16px;
    font-weight: 600;
    color: #e74c3c;
    font-family: monospace;
    min-width: 50px;
}

/* Time display */
.trim-time-display {
    display: flex;
    justify-content: space-around;
    gap: 15px;
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

body.dark-mode .trim-time-display {
    background: #333;
}

.trim-time-item {
    text-align: center;
}

.trim-time-label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

body.dark-mode .trim-time-label {
    color: #999;
}

.trim-time-value {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    font-family: monospace;
}

body.dark-mode .trim-time-value {
    color: #e0e0e0;
}

.trim-new-duration .trim-time-value {
    color: #27ae60;
}

body.dark-mode .trim-new-duration .trim-time-value {
    color: #2ecc71;
}

/* Playback controls */
.trim-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
}

.btn-trim-play,
.btn-trim-full,
.btn-trim-position {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-trim-position {
    background: #e74c3c;
    color: white;
}

.btn-trim-position:hover {
    background: #c0392b;
}

.btn-trim-play {
    background: #3498db;
    color: white;
}

.btn-trim-play:hover {
    background: #2980b9;
}

.btn-trim-full {
    background: #95a5a6;
    color: white;
}

.btn-trim-full:hover {
    background: #7f8c8d;
}

/* Skip buttons (jump 5 seconds) */
.btn-trim-skip {
    padding: 10px 14px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    background: #34495e;
    color: white;
    white-space: nowrap;
}

.btn-trim-skip:hover {
    background: #2c3e50;
}

/* Volume / gain controls */
.trim-gain {
    margin-bottom: 15px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 5px;
}

body.dark-mode .trim-gain {
    background: #333;
}

.trim-gain-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.trim-gain-row + .trim-gain-row {
    margin-top: 10px;
}

.trim-gain-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    min-width: 56px;
}

body.dark-mode .trim-gain-title {
    color: #e0e0e0;
}

.trim-gain-slider {
    flex: 1;
    accent-color: #e67e22;
    cursor: pointer;
}

.trim-gain-value {
    font-family: monospace;
    font-size: 15px;
    font-weight: 600;
    color: #e67e22;
    min-width: 64px;
    text-align: right;
}

.trim-gain-actions {
    flex-wrap: wrap;
}

.btn-trim-normalize {
    padding: 7px 14px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    background: #27ae60;
    color: white;
}

.btn-trim-normalize:hover {
    background: #229954;
}

.btn-trim-gain-reset {
    padding: 7px 14px;
    border: 1px solid #bbb;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    background: transparent;
    color: #666;
}

.btn-trim-gain-reset:hover {
    background: rgba(0, 0, 0, 0.06);
}

body.dark-mode .btn-trim-gain-reset {
    border-color: #555;
    color: #bbb;
}

body.dark-mode .btn-trim-gain-reset:hover {
    background: rgba(255, 255, 255, 0.08);
}

.trim-gain-hint {
    flex: 1;
    min-width: 180px;
    font-size: 12px;
    color: #666;
}

body.dark-mode .trim-gain-hint {
    color: #999;
}

.trim-gain-hint.trim-gain-warn {
    color: #c0392b;
    font-weight: 600;
}

body.dark-mode .trim-gain-hint.trim-gain-warn {
    color: #e74c3c;
}

/* Informational note — only brief spikes clip, not a real problem */
.trim-gain-hint.trim-gain-note {
    color: #b9770e;
    font-weight: 600;
}

body.dark-mode .trim-gain-hint.trim-gain-note {
    color: #e0a458;
}

/* Fine-tune inputs */
.trim-inputs {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin-bottom: 15px;
}

.trim-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.trim-input-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

body.dark-mode .trim-input-label {
    color: #999;
}

.trim-time-inputs {
    display: flex;
    align-items: center;
    gap: 4px;
}

.trim-time-inputs input {
    width: 65px;
    padding: 8px 4px 8px 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-align: center;
    font-family: monospace;
    font-size: 16px;
    -moz-appearance: textfield;
}

/* Always show spinner arrows */
.trim-time-inputs input::-webkit-outer-spin-button,
.trim-time-inputs input::-webkit-inner-spin-button {
    opacity: 1;
    margin-left: 4px;
}

body.dark-mode .trim-time-inputs input {
    background: #333;
    border-color: #444;
    color: #e0e0e0;
}

.trim-time-separator {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

body.dark-mode .trim-time-separator {
    color: #e0e0e0;
}

/* Save button variant */
.btn-trim-save {
    background: #e67e22;
}

.btn-trim-save:hover {
    background: #d35400;
}

/* Processing indicator */
#trim-processing {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 5px;
    margin-top: 15px;
}

body.dark-mode #trim-processing {
    background: #333;
}

.trim-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #ddd;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: trim-spin 1s linear infinite;
}

@keyframes trim-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error display */
.trim-error {
    padding: 12px;
    background: #f8d7da;
    color: #721c24;
    border-radius: 5px;
    margin-top: 15px;
    text-align: center;
}

body.dark-mode .trim-error {
    background: #4a1f1f;
    color: #f5c6cb;
}

/* Trim button in recordings list */
.btn-trim {
    padding: 6px 12px;
    background: transparent;
    color: #e67e22;
    border: 2px solid #e67e22;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
}

.btn-trim:hover {
    background: #e67e22;
    color: white;
}

/* Mobile card button */
.recording-card .btn-trim {
    padding: 8px 12px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .modal-trim {
        width: 98%;
        max-height: 95vh;
        overflow-y: auto;
        padding: 15px;
    }

    .trim-info {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }

    .trim-time-display {
        flex-direction: column;
        gap: 10px;
    }

    .trim-controls {
        flex-direction: column;
    }

    .trim-controls button {
        width: 100%;
    }

    .trim-inputs {
        flex-direction: column;
        gap: 15px;
    }

    .trim-input-group {
        width: 100%;
    }

    .trim-time-inputs {
        justify-content: center;
    }

    .trim-time-inputs input {
        width: 65px;
    }
}
