/**
 * Voice Recorder Styles
 * Beautiful, mobile-optimized recording interface
 */

/* =========================================
   RECORDER PAGE LAYOUT
   ========================================= */

#record {
    background: linear-gradient(160deg, #0a1628 0%, #0F172A 30%, #1E3A8A 70%, #0F172A 100%);
    position: relative;
    overflow: hidden;
}

#record::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(252, 211, 77, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse 50% 30% at 20% 80%, rgba(197, 160, 89, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

.recorder-page-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-6);
    position: relative;
    z-index: 1;
}

/* =========================================
   RECORDER HEADER
   ========================================= */

.recorder-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.recorder-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.2rem;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #FCD34D;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: var(--text-xs);
    margin-bottom: var(--space-4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.recorder-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 6vw, 3.5rem);
    color: white;
    margin-bottom: var(--space-3);
    line-height: 1.1;
}

.recorder-title-accent {
    background: linear-gradient(90deg, #C5A059, #FCD34D, #D4AF37);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.recorder-subtitle {
    color: rgba(255, 255, 255, 0.75);
    font-family: var(--font-serif);
    font-size: var(--text-lg);
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}

/* =========================================
   RECORDER CONTAINER
   ========================================= */

#recorder-container {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-3xl);
    padding: var(--space-8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 
        0 25px 80px -20px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(197, 160, 89, 0.05);
    position: relative;
    overflow: hidden;
}

#recorder-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(252, 211, 77, 0.4), transparent);
}

/* =========================================
   VISUALIZER SECTION
   ========================================= */

.recorder-visualizer-wrapper {
    position: relative;
    margin-bottom: var(--space-6);
    border-radius: var(--radius-2xl);
    background: rgba(0, 0, 0, 0.3);
    padding: var(--space-4);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

#recorder-visualizer {
    width: 100%;
    height: 120px;
    display: block;
    border-radius: var(--radius-xl);
}

/* =========================================
   MAIN CONTROL AREA
   ========================================= */

.recorder-main-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-6);
    margin-bottom: var(--space-6);
}

/* Timer Display */
.recorder-timer-display {
    text-align: center;
}

#recorder-timer {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: clamp(3rem, 12vw, 5rem);
    font-weight: 300;
    color: white;
    letter-spacing: 0.05em;
    line-height: 1;
    text-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.state-recording #recorder-timer {
    color: #FCD34D;
    animation: timerPulse 1s ease-in-out infinite;
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

#recorder-status {
    color: rgba(255, 255, 255, 0.6);
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: var(--space-2);
}

.state-recording #recorder-status {
    color: #FCD34D;
}

.state-paused #recorder-status {
    color: #f59e0b;
}

.state-has-recording #recorder-status,
.state-playing #recorder-status {
    color: #10b981;
}

/* =========================================
   RECORD BUTTON - MAIN
   ========================================= */

.recorder-record-area {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Pulse Ring Animation */
.recorder-pulse-ring {
    position: absolute;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 2px solid rgba(252, 211, 77, 0.3);
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

.state-recording .recorder-pulse-ring {
    animation: pulseRing 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulseRing {
    0% {
        opacity: 0.6;
        transform: scale(0.85);
    }
    100% {
        opacity: 0;
        transform: scale(1.4);
    }
}

/* Main Record Button */
#recorder-record-btn {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ef4444, #dc2626);
    border: 4px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 8px 40px rgba(239, 68, 68, 0.4),
        0 0 0 0 rgba(239, 68, 68, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 2;
}

#recorder-record-btn:hover {
    transform: scale(1.05);
    box-shadow: 
        0 12px 50px rgba(239, 68, 68, 0.5),
        0 0 0 8px rgba(239, 68, 68, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

#recorder-record-btn:active,
#recorder-record-btn.pressed {
    transform: scale(0.95);
}

#recorder-record-btn .recorder-btn-icon {
    color: white;
}

#recorder-record-btn .recorder-btn-label {
    color: white;
    font-size: var(--text-xs);
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* Recording state */
#recorder-record-btn.recording {
    animation: recordingPulse 1.5s ease-in-out infinite;
    background: linear-gradient(145deg, #ef4444, #b91c1c);
}

@keyframes recordingPulse {
    0%, 100% {
        box-shadow: 
            0 8px 40px rgba(239, 68, 68, 0.5),
            0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        box-shadow: 
            0 8px 50px rgba(239, 68, 68, 0.6),
            0 0 0 15px rgba(239, 68, 68, 0.1);
    }
}

/* New recording state (smaller button) */
#recorder-record-btn.new-recording {
    width: 80px;
    height: 80px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#recorder-record-btn.new-recording:hover {
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.3), rgba(239, 68, 68, 0.15));
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 
        0 8px 30px rgba(239, 68, 68, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* =========================================
   SECONDARY BUTTONS
   ========================================= */

.recorder-secondary-controls {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
    flex-wrap: wrap;
}

.recorder-btn-secondary {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    width: 80px;
    height: 80px;
    border-radius: var(--radius-2xl);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
}

.recorder-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.recorder-btn-secondary:active,
.recorder-btn-secondary.pressed {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.2);
}

.recorder-btn-secondary .recorder-btn-icon {
    color: rgba(255, 255, 255, 0.9);
}

.recorder-btn-secondary .recorder-btn-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
}

/* Pause Button - Yellow accent */
#recorder-pause-btn {
    background: linear-gradient(145deg, rgba(251, 191, 36, 0.2), rgba(251, 191, 36, 0.1));
    border-color: rgba(251, 191, 36, 0.4);
}

#recorder-pause-btn:hover {
    background: linear-gradient(145deg, rgba(251, 191, 36, 0.3), rgba(251, 191, 36, 0.15));
    border-color: rgba(251, 191, 36, 0.6);
    box-shadow: 0 8px 25px rgba(251, 191, 36, 0.2);
}

#recorder-pause-btn .recorder-btn-icon {
    color: #fbbf24;
}

/* Stop Button - Red accent */
#recorder-stop-btn {
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.1));
    border-color: rgba(239, 68, 68, 0.4);
}

#recorder-stop-btn:hover {
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.3), rgba(239, 68, 68, 0.15));
    border-color: rgba(239, 68, 68, 0.6);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.2);
}

#recorder-stop-btn .recorder-btn-icon {
    color: #ef4444;
}

/* Play Button - Green accent */
#recorder-play-btn {
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
    border-color: rgba(16, 185, 129, 0.4);
}

#recorder-play-btn:hover {
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.3), rgba(16, 185, 129, 0.15));
    border-color: rgba(16, 185, 129, 0.6);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.2);
}

#recorder-play-btn .recorder-btn-icon {
    color: #10b981;
}

/* Delete Button - Subtle */
#recorder-delete-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

#recorder-delete-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
}

#recorder-delete-btn:hover .recorder-btn-icon {
    color: #ef4444;
}

/* Download Button - Gold accent */
#recorder-download-btn {
    background: linear-gradient(145deg, rgba(197, 160, 89, 0.2), rgba(197, 160, 89, 0.1));
    border-color: rgba(197, 160, 89, 0.4);
}

#recorder-download-btn:hover {
    background: linear-gradient(145deg, rgba(197, 160, 89, 0.3), rgba(197, 160, 89, 0.15));
    border-color: rgba(197, 160, 89, 0.6);
    box-shadow: 0 8px 25px rgba(197, 160, 89, 0.2);
}

#recorder-download-btn .recorder-btn-icon {
    color: #C5A059;
}

/* =========================================
   RECORDING TIPS
   ========================================= */

.recorder-tips {
    margin-top: var(--space-8);
    padding-top: var(--space-6);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.recorder-tips-title {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 800;
    font-size: var(--text-sm);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.recorder-tips-title i {
    color: #FCD34D;
}

.recorder-tips-list {
    display: grid;
    gap: var(--space-3);
}

.recorder-tip {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.recorder-tip-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: rgba(197, 160, 89, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FCD34D;
}

.recorder-tip-text {
    color: rgba(255, 255, 255, 0.75);
    font-size: var(--text-sm);
    line-height: 1.5;
}

/* =========================================
   WAVEFORM BARS (in record button area)
   ========================================= */

.recorder-waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 50px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.state-recording .recorder-waveform {
    opacity: 1;
}

.recorder-waveform-bar {
    width: 4px;
    height: 20px;
    background: linear-gradient(180deg, #FCD34D, #C5A059);
    border-radius: 2px;
    transition: height 0.1s ease;
}

/* =========================================
   SUBMIT SECTION
   ========================================= */

.recorder-submit-section {
    margin-top: var(--space-8);
    padding: var(--space-6);
    background: linear-gradient(135deg, rgba(197, 160, 89, 0.1), rgba(197, 160, 89, 0.03));
    border: 1px solid rgba(197, 160, 89, 0.25);
    border-radius: var(--radius-2xl);
}

.recorder-submit-header {
    margin-bottom: var(--space-4);
}

.recorder-submit-title {
    color: white;
    font-family: var(--font-display);
    font-size: var(--text-xl);
    margin-bottom: var(--space-1);
}

.recorder-submit-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--text-sm);
}

.recorder-submit-form {
    display: grid;
    gap: var(--space-4);
}

.recorder-form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.recorder-form-label {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
    font-size: var(--text-sm);
}

.recorder-form-input,
.recorder-form-select,
.recorder-form-textarea {
    padding: var(--space-3) var(--space-4);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    color: white;
    font-size: var(--text-base);
    transition: all 0.2s ease;
}

.recorder-form-input:focus,
.recorder-form-select:focus,
.recorder-form-textarea:focus {
    outline: none;
    border-color: rgba(197, 160, 89, 0.5);
    box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.15);
}

.recorder-form-input::placeholder,
.recorder-form-textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.recorder-form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 44px;
}

.recorder-form-select option {
    background: #1E3A8A;
    color: white;
}

.recorder-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-6);
    background: linear-gradient(135deg, #C5A059, #D4AF37);
    border: none;
    border-radius: var(--radius-lg);
    color: var(--color-navy-dark);
    font-weight: 800;
    font-size: var(--text-sm);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 8px 25px rgba(197, 160, 89, 0.3);
}

.recorder-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(197, 160, 89, 0.4);
}

.recorder-submit-btn:active {
    transform: translateY(0);
}

.recorder-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* =========================================
   MOBILE OPTIMIZATIONS
   ========================================= */

@media (max-width: 767px) {
    .recorder-page-wrapper {
        padding: var(--space-4);
        padding-bottom: calc(var(--space-8) + 80px);
    }
    
    .recorder-header {
        margin-bottom: var(--space-6);
    }
    
    #recorder-container {
        padding: var(--space-5);
        border-radius: var(--radius-2xl);
    }
    
    .recorder-visualizer-wrapper {
        padding: var(--space-3);
        margin-bottom: var(--space-5);
    }
    
    #recorder-visualizer {
        height: 100px;
    }
    
    #recorder-timer {
        font-size: clamp(2.5rem, 15vw, 4rem);
    }
    
    #recorder-record-btn {
        width: 120px;
        height: 120px;
    }
    
    #recorder-record-btn.new-recording {
        width: 70px;
        height: 70px;
    }
    
    .recorder-secondary-controls {
        gap: var(--space-3);
    }
    
    .recorder-btn-secondary {
        width: 70px;
        height: 70px;
    }
    
    .recorder-tips {
        margin-top: var(--space-6);
        padding-top: var(--space-5);
    }
    
    .recorder-submit-section {
        margin-top: var(--space-6);
        padding: var(--space-4);
    }
}

@media (max-width: 374px) {
    #recorder-record-btn {
        width: 100px;
        height: 100px;
    }
    
    #recorder-record-btn.new-recording {
        width: 60px;
        height: 60px;
    }
    
    .recorder-btn-secondary {
        width: 60px;
        height: 60px;
    }
    
    .recorder-btn-secondary .recorder-btn-label {
        display: none;
    }
}

/* =========================================
   LANDSCAPE MOBILE
   ========================================= */

@media (max-width: 767px) and (orientation: landscape) {
    .recorder-main-control {
        flex-direction: row;
        gap: var(--space-8);
    }
    
    .recorder-timer-display {
        text-align: left;
    }
    
    #recorder-timer {
        font-size: 3rem;
    }
    
    .recorder-secondary-controls {
        flex-direction: column;
        gap: var(--space-2);
    }
    
    .recorder-btn-secondary {
        width: 60px;
        height: 60px;
    }
}

/* =========================================
   ACCESSIBILITY
   ========================================= */

#recorder-record-btn:focus-visible,
.recorder-btn-secondary:focus-visible {
    outline: 3px solid #FCD34D;
    outline-offset: 3px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .state-recording .recorder-pulse-ring,
    #recorder-record-btn.recording,
    .state-recording #recorder-timer,
    .recorder-title-accent {
        animation: none !important;
    }
    
    .recorder-waveform-bar {
        transition: none;
    }
}

/* Animation utilities */
.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Entrance animations */
.recorder-header {
    animation: fadeInUp 0.6s ease-out;
}

#recorder-container {
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

.recorder-submit-section {
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

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

/* Button hover glow effects */
#recorder-record-btn::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.3), rgba(220, 38, 38, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

#recorder-record-btn:hover::after {
    opacity: 1;
}

/* Focus visible states */
.recorder-form-input:focus-visible,
.recorder-form-select:focus-visible,
.recorder-form-textarea:focus-visible {
    outline: 2px solid #FCD34D;
    outline-offset: 2px;
}

/* Success state for timer */
.state-has-recording #recorder-timer {
    color: #10b981;
}

/* Shake animation for errors */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* =========================================
   DARK MODE ENHANCEMENTS
   ========================================= */

@media (prefers-color-scheme: dark) {
    .recorder-form-select option {
        background: #0F172A;
    }
}
