:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --glass-bg: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-color: #f8fafc;
    --danger-color: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body, html {
    width: 100%;
    height: 100%;
    font-family: 'Inter', sans-serif;
    background-color: #000;
    color: var(--text-color);
    overflow: hidden;
}

/* Background Video */
#video-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    transform: scaleX(-1); /* Mirror for natural feel */
}

/* Master Container */
.app-container {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Setup View */
.setup-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    padding: 20px;
    background: rgba(0,0,0,0.4);
    transition: opacity 0.3s ease;
}

.main-panel {
    width: 100%;
    max-width: 800px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.main-panel h1 {
    font-size: 2.5rem;
    background: -webkit-linear-gradient(45deg, #a855f7, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#script-input {
    width: 100%;
    height: 300px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 20px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-family: 'Inter', sans-serif;
    resize: none;
    outline: none;
}
#script-input:focus {
    border-color: var(--primary-color);
}

/* Buttons */
.primary-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
}
.primary-btn:hover {
    background-color: var(--primary-hover);
}
.secondary-btn {
    background-color: transparent;
    border: 1px solid var(--glass-border);
    color: white;
    padding: 15px 30px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.secondary-btn:hover {
    background: rgba(255,255,255,0.1);
}

/* Teleprompter View */
.teleprompter-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 75%; /* Leave room for controls at bottom */
    overflow: hidden;
    z-index: 20;
    mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
}

#text-scroller {
    position: absolute;
    width: 80%;
    left: 10%;
    top: 60%;
    transform: translateY(0);
    text-align: center;
    font-family: 'Oswald', sans-serif;
    color: #ffd700;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.9), -1px -1px 4px rgba(0,0,0,0.8);
    line-height: 1.6;
    will-change: transform;
    white-space: pre-wrap;
    padding-bottom: 70vh; /* space to scroll fully off screen */
}

.read-line {
    position: absolute;
    top: 40%;
    left: 5%;
    width: 90%;
    height: 4px;
    background-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
    transform: translateY(-50%);
    z-index: 21;
    pointer-events: none;
    border-radius: 2px;
}

/* Controls Panel */
.control-panel {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 900px;
    padding: 20px 30px;
    z-index: 30;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s, opacity 0.3s;
}
.control-panel.minimal {
    opacity: 0.2;
}
.control-panel:hover {
    opacity: 1;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}
.control-group label {
    font-size: 0.85rem;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.range-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}
.range-icon {
    color: #94a3b8;
}

/* Custom Input Range */
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    margin-top: -8px;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}
input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
}

.actions-group {
    display: flex;
    gap: 15px;
    align-items: center;
}

.icon-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-btn:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.05);
}
.icon-btn.record-btn {
    width: auto;
    padding: 0 20px;
    border-radius: 25px;
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
    gap: 8px;
    font-weight: 600;
}
.icon-btn.record-btn:hover {
    background: rgba(239, 68, 68, 0.4);
}
.icon-btn.record-btn i {
    color: var(--danger-color);
}
#btn-stop {
    width: auto;
    padding: 0 20px;
    border-radius: 25px;
    background: rgba(255,255,255,0.9);
    color: black;
    font-weight: bold;
    gap: 8px;
}
#btn-stop i {
    color: var(--danger-color);
}

/* Recording Indicator Top Right */
.recording-indicator {
    position: absolute;
    top: 30px;
    right: 30px;
    background: rgba(0,0,0,0.6);
    padding: 10px 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    z-index: 40;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.red-dot {
    width: 12px;
    height: 12px;
    background-color: var(--danger-color);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { opacity: 0.5; box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { opacity: 1; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}


/* Modal */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}
.modal-content {
    background: var(--glass-bg);
    padding: 40px;
    border-radius: 16px;
    max-width: 800px;
    width: 90%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}
.modal-content video {
    width: 100%;
    max-height: 50vh;
    border-radius: 8px;
    background: black;
}
.modal-actions {
    display: flex;
    gap: 20px;
    width: 100%;
    justify-content: center;
}


/* Utilities */
.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .control-panel {
        flex-direction: column;
        bottom: 10px;
        padding: 15px;
    }
    .actions-group {
        width: 100%;
        justify-content: space-around;
        margin-top: 10px;
    }
    .main-panel h1 {
        font-size: 1.8rem;
    }
}
