/* Preview Modal pro Text-to-Speech */
/* Všechny styly používají prefix prev- aby se nemíchaly s hlavními styly */

/* Modal wrapper - overlay */
.prev-modal-wrapper {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.prev-modal-wrapper.show {
    display: flex;
    opacity: 1;
}

/* Modal container */
.prev-modal-container {
    width: 800px;
    height: 600px;
    background: #2d2d2d;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    animation: prevModalSlideIn 0.3s ease;
}

@keyframes prevModalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modal header */
.prev-modal-header {
    padding: 20px;
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.prev-modal-title {
    font-size: 18px;
    color: #fff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.prev-modal-close {
    background: transparent;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.prev-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Modal body */
.prev-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Speak preview specific styles */
.prev-speak-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Text display section */
.prev-speak-section {
    flex-shrink: 0;
}

.prev-speak-label {
    display: block;
    color: #aaa;
    font-size: 13px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.prev-speak-text-display {
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 15px;
    color: #fff;
    font-size: 16px;
    line-height: 1.6;
    max-height: 150px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Scrollbar for text display */
.prev-speak-text-display::-webkit-scrollbar {
    width: 8px;
}

.prev-speak-text-display::-webkit-scrollbar-track {
    background: #2d2d2d;
    border-radius: 4px;
}

.prev-speak-text-display::-webkit-scrollbar-thumb {
    background: #4A90E2;
    border-radius: 4px;
}

/* Info grid */
.prev-speak-info {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    padding: 15px;
}

.prev-speak-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.prev-speak-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.prev-speak-info-label {
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.prev-speak-info-value {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

/* Control buttons */
.prev-speak-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    padding: 20px 0;
}

.prev-speak-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 120px;
    justify-content: center;
}

.prev-speak-btn-icon {
    font-size: 16px;
}

.prev-speak-btn-play {
    background: #52C41A;
    color: white;
}

.prev-speak-btn-play:hover:not(:disabled) {
    background: #73D13D;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(82, 196, 26, 0.3);
}

.prev-speak-btn-stop {
    background: #F5222D;
    color: white;
}

.prev-speak-btn-stop:hover:not(:disabled) {
    background: #FF4D4F;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 34, 45, 0.3);
}

.prev-speak-btn:disabled,
.prev-speak-btn-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

/* Progress section */
.prev-speak-progress-container {
    margin-top: auto;
    padding-top: 20px;
}

.prev-speak-time {
    display: flex;
    justify-content: center;
    gap: 8px;
    color: #aaa;
    font-size: 13px;
    margin-bottom: 10px;
    font-family: 'Monaco', 'Courier New', monospace;
}

.prev-speak-progress-bar {
    height: 6px;
    background: #1a1a1a;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.prev-speak-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #52C41A, #73D13D);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
}

.prev-speak-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3));
    animation: prevProgressShine 2s linear infinite;
}

@keyframes prevProgressShine {
    0% {
        transform: translateX(-20px);
    }
    100% {
        transform: translateX(20px);
    }
}

/* Status section */
.prev-speak-status {
    text-align: center;
    color: #888;
    font-size: 12px;
    margin-top: 15px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Loading state */
.prev-speak-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.prev-speak-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #4A90E2;
    border-top-color: transparent;
    border-radius: 50%;
    animation: prevSpinning 0.8s linear infinite;
}

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

/* Responsive adjustments */
@media (max-width: 900px) {
    .prev-modal-container {
        width: 90vw;
        max-width: 800px;
        height: 80vh;
        max-height: 600px;
    }
    
    .prev-speak-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .prev-speak-info-grid {
        grid-template-columns: 1fr;
    }
    
    .prev-speak-controls {
        flex-direction: column;
    }
    
    .prev-speak-btn {
        width: 100%;
    }
}
