/* CSS Variables — NOTIFI Brand */
:root {
    --bg-primary: #1D252C;
    --bg-secondary: #1D252C;
    --bg-tertiary: #232d36;
    --bg-card: #232d36;
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.45);
    --accent-primary: #E2E548;
    --accent-hover: #c8cc3a;
    --accent-gradient: linear-gradient(135deg, #E2E548 0%, #c8cc3a 100%);
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --border-color: #2d3740;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    padding: 1rem 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* User avatar + dropdown menu */
.user-menu {
    position: relative;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: var(--bg-primary);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.user-avatar:hover {
    opacity: 0.85;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 100;
    overflow: hidden;
}

.user-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-dropdown-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-dropdown-email {
    font-size: 0.75rem;
    color: var(--text-secondary);
    word-break: break-all;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 0.875rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.15s;
}

.user-dropdown-item:hover {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
}

.user-dropdown-item--danger {
    color: #f87171;
}

.user-dropdown-item--danger:hover {
    background: rgba(248, 113, 113, 0.08);
    color: #f87171;
}


.btn-nav {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: var(--transition);
}

.btn-nav:hover {
    background: var(--border-color);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.logo-icon {
    display: flex;
    align-items: center;
}

.logo-text {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-primary);
    letter-spacing: 0.1em;
}

/* Main Content */
.app-main {
    flex: 1;
    padding: 2rem;
    padding-bottom: 3rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* Footer */
.app-footer {
    padding: 1rem 2rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Recorder Container */
.recorder-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: 600px;
}

/* Cards */
.recorder-card,
.instructions-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    border: none;
    padding: 2rem;
    box-shadow: none;
}

.recorder-title {
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.recorder-subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 2rem;
}

/* Visualizer */
.visualizer-container {
    position: relative;
    width: 100%;
    height: 120px;
    background: #141b21;
    border: 1px solid #3d5060;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1rem;
}

.visualizer {
    width: 100%;
    height: 100%;
}

.recording-indicator {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-full);
    opacity: 0;
    transition: var(--transition);
}

.recording-indicator.active {
    opacity: 1;
}

.recording-indicator.recorded {
    opacity: 1;
    background: rgba(16, 185, 129, 0.2);
}

.recording-indicator.recorded .pulse {
    background: var(--success);
    animation: none;
}

.recording-indicator.recorded .recording-text {
    color: var(--success);
}

.recording-indicator.listening {
    opacity: 1;
    background: rgba(56, 189, 248, 0.15);
}

.recording-indicator.listening .pulse {
    background: #38bdf8;
    animation: pulse-listening 2s ease-in-out infinite;
}

.recording-indicator.listening .recording-text {
    color: #38bdf8;
}

@keyframes pulse-listening {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(1.1); }
}

.pulse {
    width: 8px;
    height: 8px;
    background: var(--error);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.recording-text {
    color: var(--error);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Timer */
.timer {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    background: rgba(0, 0, 0, 0.35);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    z-index: 2;
}

.timer-active { color: var(--accent-primary); }
.timer-inactive { color: rgba(255, 255, 255, 0.45); }
.timer-sep { color: rgba(255, 255, 255, 0.25); }

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.btn svg {
    width: 20px;
    height: 20px;
}

.btn-record {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: #1D252C;
    box-shadow: 0 4px 20px rgba(226, 229, 72, 0.3);
}

.btn-record:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 30px rgba(226, 229, 72, 0.4);
    background: var(--accent-hover);
}

.btn-record:active {
    transform: scale(0.98);
}

.btn-record.recording {
    background: var(--error);
    color: white;
    animation: recording-pulse 2s ease-in-out infinite;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}

@keyframes recording-pulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 4px 40px rgba(239, 68, 68, 0.6); }
}

.btn-record .icon {
    width: 32px;
    height: 32px;
}

.btn-primary {
    background: var(--accent-primary);
    color: #1D252C;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Audio Preview */
.audio-preview {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.audio-preview h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.audio-preview audio {
    width: 100%;
    margin-bottom: 1rem;
    border-radius: var(--radius-sm);
}

.preview-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.preview-actions .btn {
    flex: 1;
    min-width: 140px;
}

/* Status Messages */
.status-container {
    min-height: 60px;
}

.status {
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
    font-weight: 500;
    animation: fadeIn 0.3s ease;
}

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

.status.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status.loading {
    background: rgba(226, 229, 72, 0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(226, 229, 72, 0.3);
}

.status.info {
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.25);
}

/* Instructions */
.instructions-card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.steps {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.steps li {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.step-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary);
    color: #1D252C;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.step-text {
    color: var(--text-secondary);
}

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

/* Responsive */
@media (max-width: 640px) {
    .app-main {
        padding: 1rem;
    }

    .recorder-card,
    .instructions-card {
        padding: 1.5rem;
    }

    .recorder-title {
        font-size: 1.5rem;
    }

    .timer {
        font-size: 2rem;
    }

    .preview-actions {
        flex-direction: column;
    }

    .preview-actions .btn {
        width: 100%;
    }
}

/* Custom Audio Player Styling */
audio::-webkit-media-controls-panel {
    background: var(--bg-secondary);
}

audio::-webkit-media-controls-play-button,
audio::-webkit-media-controls-mute-button {
    filter: invert(1);
}
