:root {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --panel-bg: rgba(30, 41, 59, 0.4);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    
    /* Status Colors */
    --color-idle: #10b981;
    --color-pending: #f59e0b;
    --color-recording: #ef4444;
    --color-uploading: #06b6d4;
    --color-offline: #64748b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: #0f172a;
    background-image: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
    padding: 2rem 1rem;
}

/* Background Glow Effects */
.background-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(0,0,0,0) 70%);
    top: -100px;
    left: -100px;
    z-index: 0;
    pointer-events: none;
}

.app-container {
    width: 100%;
    max-width: 520px;
    z-index: 1;
    position: relative;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-container {
    position: relative;
    width: 64px;
    height: 64px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 1rem;
}

.logo-icon {
    color: var(--primary);
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(99, 102, 241, 0.3);
    animation: ring-pulse 3s infinite ease-out;
}

@keyframes ring-pulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.4); opacity: 0; }
}

h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 0.25rem;
    background: linear-gradient(90deg, #f8fafc, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Dashboard Panel Card */
.dashboard-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    margin-bottom: 2rem;
}

.recorder-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-offline);
}

.status-badge.online .status-dot {
    background-color: var(--color-idle);
    box-shadow: 0 0 10px var(--color-idle);
}

.status-badge.recording .status-dot {
    background-color: var(--color-recording);
    box-shadow: 0 0 10px var(--color-recording);
    animation: flash 1s infinite alternate;
}

.status-badge.pending .status-dot {
    background-color: var(--color-pending);
    box-shadow: 0 0 10px var(--color-pending);
    animation: flash 0.6s infinite alternate;
}

.status-badge.uploading .status-dot {
    background-color: var(--color-uploading);
    box-shadow: 0 0 10px var(--color-uploading);
}

.status-badge.offline .status-dot {
    background-color: var(--color-offline);
}

@keyframes flash {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* Timer Display */
.timer-display {
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 2rem;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Record Button Styling */
.control-buttons {
    margin-bottom: 1.5rem;
}

.btn-record {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(99, 102, 241, 0.05) 100%);
    border: 2px solid rgba(99, 102, 241, 0.3);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.btn-inner {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-primary);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-record:not(:disabled):hover {
    transform: scale(1.05);
    border-color: rgba(99, 102, 241, 0.6);
}

.btn-record:not(:disabled):hover .btn-inner {
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.6);
}

.btn-record:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Recording Pulse state */
.btn-record.recording-active {
    border-color: rgba(239, 68, 68, 0.4);
}

.btn-record.recording-active .btn-inner {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.6);
    border-radius: 20px; /* morph to rounded square */
    width: 80px;
    height: 80px;
}

.instructions {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
    max-width: 280px;
    line-height: 1.4;
}

/* Audio Recordings Section */
.recordings-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.audio-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Custom Scrollbar for Audio List */
.audio-list::-webkit-scrollbar {
    width: 6px;
}
.audio-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}
.audio-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
.audio-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.no-recordings {
    background: rgba(30, 41, 59, 0.2);
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Recording Card Item */
.audio-card {
    background: rgba(30, 41, 59, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.audio-card:hover {
    background: rgba(30, 41, 59, 0.45);
    border-color: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.audio-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.audio-title {
    font-size: 0.95rem;
    font-weight: 600;
}

.audio-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.audio-controls-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Custom Audio Player */
.custom-audio-player {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-grow: 1;
    background: rgba(15, 23, 42, 0.4);
    padding: 6px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-play-pause {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
    transition: all 0.2s ease;
}

.btn-play-pause:hover {
    transform: scale(1.08);
    background: var(--primary-hover);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.5);
}

.player-timeline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-grow: 1;
}

.time-current, .time-duration {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    min-width: 32px;
}

.seek-slider {
    flex-grow: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    cursor: pointer;
    transition: background 0.1s ease;
}

.seek-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-primary);
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
    transition: transform 0.1s ease;
}

.seek-slider::-webkit-slider-thumb:hover {
    transform: scale(1.3);
}

.seek-slider::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border: none;
    border-radius: 50%;
    background: var(--text-primary);
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
    transition: transform 0.1s ease;
}

.seek-slider::-moz-range-thumb:hover {
    transform: scale(1.3);
}

.hidden {
    display: none !important;
}

/* Buttons style */
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-small {
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

.btn-download {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.btn-download:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.btn-delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-recording);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-delete:hover {
    background: var(--color-recording);
    color: white;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.audio-actions {
    display: flex;
    gap: 8px;
}

/* Live Stream Button styling */
.btn-live {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    outline: none;
}

.btn-live:not(:disabled):hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.btn-live:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary);
    display: inline-block;
    transition: all 0.3s ease;
}

.btn-live.streaming-active {
    background: linear-gradient(135deg, var(--color-uploading) 0%, #0891b2 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
}

.btn-live.streaming-active:hover {
    background: #0891b2;
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.6);
}

.btn-live.streaming-active .live-dot {
    background-color: white;
    box-shadow: 0 0 8px white;
    animation: flash 1s infinite alternate;
}

/* Responsive Design for Mobile */
@media (max-width: 600px) {
    body {
        padding: 1rem 0.5rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    .dashboard-card {
        padding: 1.5rem 1rem;
        margin-bottom: 1.5rem;
    }

    .timer-display {
        font-size: 2.8rem;
        margin-bottom: 1.5rem;
    }

    .btn-record {
        width: 90px;
        height: 90px;
    }

    .btn-inner {
        width: 70px;
        height: 70px;
    }

    .btn-record.recording-active .btn-inner {
        width: 64px;
        height: 64px;
    }

    .audio-card {
        padding: 1rem;
    }

    .audio-controls-row {
        flex-direction: column;
        align-items: stretch;
    }

    .custom-audio-player {
        width: 100%;
        margin-bottom: 8px;
    }

    .audio-actions {
        justify-content: flex-end;
        width: 100%;
    }
}
