/* ============================================
   DOG BARK DETECTION SYSTEM
   Custom Modern Design v2.0
   ============================================ */

:root {
    /* Primary Color Palette - Modern Purple Gradient */
    --primary-50: #f5f3ff;
    --primary-100: #ede9fe;
    --primary-200: #ddd6fe;
    --primary-300: #c4b5fd;
    --primary-400: #a78bfa;
    --primary-500: #8b5cf6;
    --primary-600: #7c3aed;
    --primary-700: #6d28d9;
    --primary-800: #5b21b6;
    --primary-900: #4c1d95;

    /* Accent Colors */
    --accent-coral: #f43f5e;
    --accent-teal: #14b8a6;
    --accent-amber: #f59e0b;
    --accent-emerald: #10b981;

    /* Neutral Colors - Modern Slate */
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;

    /* Bark Detection Colors */
    --bark-primary: var(--accent-amber);
    --bark-secondary: #fb923c;
    --bark-glow: rgba(251, 146, 60, 0.3);

    /* Semantic Colors */
    --success: var(--accent-emerald);
    --error: var(--accent-coral);
    --warning: var(--accent-amber);

    /* Background */
    --bg-primary: #0a0a0f;
    --bg-secondary: #13131a;
    --bg-tertiary: #1a1a24;
    --bg-elevated: #242432;

    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-inverse: #0f172a;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.15);

    /* Shadows */
    --shadow-sm: 0 1px 2px 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);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 40px rgba(139, 92, 246, 0.15);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-400) 100%);
    --gradient-secondary: linear-gradient(135deg, var(--accent-teal) 0%, var(--accent-emerald) 100%);
    --gradient-bark: linear-gradient(135deg, var(--bark-primary) 0%, var(--bark-secondary) 100%);
    --gradient-success: linear-gradient(135deg, var(--success) 0%, #34d399 100%);
    --gradient-error: linear-gradient(135deg, var(--error) 0%, #fb7185 100%);
    --gradient-dark: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(139, 92, 246, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 80% 50%, rgba(20, 184, 166, 0.08), transparent);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============================================
   LAYOUT
   ============================================ */

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

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

header {
    text-align: center;
    margin-bottom: 3rem;
    animation: slideDown 0.6s ease-out;
}

header h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 30px rgba(139, 92, 246, 0.3));
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.125rem;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.tech-badges {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.badge {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--primary-400);
    transition: all var(--transition-base);
}

.badge:hover {
    background: var(--bg-elevated);
    border-color: var(--primary-400);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.2);
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-400), transparent);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.card:hover {
    border-color: var(--border-default);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card:hover::before {
    opacity: 1;
}

.card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: -0.02em;
}

.card h2::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
}

.section-icon {
    width: 24px;
    height: 24px;
    stroke: var(--primary-400);
    flex-shrink: 0;
}

.hidden {
    display: none !important;
}

/* ============================================
   UPLOAD AREA
   ============================================ */

.upload-area {
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    background: var(--bg-tertiary);
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.upload-area:hover {
    border-color: var(--primary-400);
    background: var(--bg-elevated);
    transform: scale(1.01);
}

.upload-area:hover::before {
    opacity: 0.05;
}

.upload-area.drag-over {
    border-color: var(--primary-400);
    background: var(--bg-elevated);
    transform: scale(1.02);
}

.upload-area.drag-over::before {
    opacity: 0.1;
}

.upload-content {
    position: relative;
    z-index: 1;
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    stroke: var(--primary-400);
    stroke-width: 1.5;
    filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.3));
    animation: float 3s ease-in-out infinite;
}

.upload-text {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.upload-subtext {
    color: var(--text-muted);
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
}

.upload-formats {
    color: var(--text-muted);
    font-size: 0.875rem;
    opacity: 0.7;
}

/* ============================================
   AUDIO PLAYER
   ============================================ */

.player-container {
    margin-bottom: 1.5rem;
}

audio {
    width: 100%;
    height: 56px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

audio::-webkit-media-controls-panel {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
}

.file-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.15), transparent);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.btn:hover::before {
    opacity: 1;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

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

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

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

.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--primary-400);
    transform: translateY(-1px);
}

.btn-secondary.active {
    background: var(--gradient-primary);
    border-color: transparent;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

.btn-icon {
    font-size: 1.25rem;
}

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

/* ============================================
   VISUALIZATION CONTROLS
   ============================================ */

.viz-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-base);
    user-select: none;
}

.checkbox-label:hover {
    background: var(--bg-elevated);
    border-color: var(--primary-400);
}

.checkbox-label input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-default);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
}

.checkbox-label input[type="checkbox"]:checked {
    background: var(--primary-500);
    border-color: var(--primary-500);
}

.checkbox-label input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* ============================================
   CANVAS & TIMELINE
   ============================================ */

.timeline-container {
    position: relative;
    margin-bottom: 2rem;
}

#waveform-canvas {
    width: 100%;
    height: 280px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    display: block;
    border: 1px solid var(--border-subtle);
    cursor: crosshair;
    transition: border-color var(--transition-base);
}

#waveform-canvas:hover {
    border-color: var(--border-default);
}

.time-axis {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
}

/* ============================================
   BARK MARKERS
   ============================================ */

.bark-markers {
    position: relative;
    height: 48px;
    margin: -24px 0 1.5rem 0;
}

.bark-marker {
    position: absolute;
    top: 0;
    height: 100%;
    background: var(--gradient-bark);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    border: 1px solid rgba(251, 146, 60, 0.5);
    box-shadow: 0 0 20px var(--bark-glow);
}

.bark-marker:hover {
    transform: scaleY(1.15) translateY(-2px);
    z-index: 10;
    box-shadow: 0 0 30px var(--bark-glow);
}

.bark-marker-tooltip {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--bg-elevated);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    white-space: nowrap;
    font-size: 0.8125rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-default);
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition-base);
}

.bark-marker:hover .bark-marker-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.bark-marker-tooltip strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

/* ============================================
   STATS DASHBOARD
   ============================================ */

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-tertiary);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    text-align: center;
    border: 1px solid var(--border-subtle);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-default);
    box-shadow: var(--shadow-md);
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   VERDICT CARD
   ============================================ */

.verdict-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    border-radius: var(--radius-xl);
    margin-bottom: 1.5rem;
    transition: all var(--transition-base);
    border: 2px solid transparent;
}

.verdict-card.bark-detected {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    border-color: var(--success);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.2);
}

.verdict-card.no-bark {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.1), rgba(244, 63, 94, 0.05));
    border-color: var(--error);
    box-shadow: 0 0 30px rgba(244, 63, 94, 0.2);
}

.verdict-card.pending {
    background: var(--bg-tertiary);
    border-color: var(--border-default);
}

.verdict-icon {
    font-size: 3rem;
    flex-shrink: 0;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.verdict-text {
    flex: 1;
}

.verdict-title {
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: 0.375rem;
    letter-spacing: -0.02em;
}

.verdict-card.bark-detected .verdict-title {
    color: var(--success);
}

.verdict-card.no-bark .verdict-title {
    color: var(--error);
}

.verdict-message {
    color: var(--text-muted);
    font-size: 0.9375rem;
}

/* ============================================
   BARK LIST
   ============================================ */

.bark-list-container {
    margin-top: 1.5rem;
}

.bark-list-container h3 {
    margin-bottom: 1rem;
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.bark-list-items {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.bark-list-items::-webkit-scrollbar {
    width: 6px;
}

.bark-list-items::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
}

.bark-list-items::-webkit-scrollbar-thumb {
    background: var(--primary-400);
    border-radius: var(--radius-full);
}

.bark-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all var(--transition-base);
}

.bark-list-item:hover {
    background: var(--bg-elevated);
    border-color: var(--bark-primary);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.bark-list-time {
    font-weight: 700;
    color: var(--bark-primary);
    min-width: 80px;
    font-size: 0.9375rem;
}

.bark-list-confidence {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.bark-list-duration {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.8125rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

/* ============================================
   LOADING OVERLAY
   ============================================ */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--primary-400);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.3);
}

.loading-overlay p {
    font-size: 1.125rem;
    color: var(--text-primary);
    margin-top: 1.5rem;
    font-weight: 500;
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .container {
        padding: 1.5rem 1rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .card {
        padding: 1.5rem;
    }

    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .upload-area {
        padding: 2rem 1.5rem;
    }

    .viz-controls {
        flex-direction: column;
    }

    .viz-controls button,
    .viz-controls label {
        width: 100%;
    }

    .verdict-card {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    #waveform-canvas {
        height: 200px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem 0.75rem;
    }

    .stats-container {
        grid-template-columns: 1fr;
    }

    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9375rem;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glow-primary {
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.3);
}

.glow-success {
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
}

.glow-error {
    box-shadow: 0 0 30px rgba(244, 63, 94, 0.3);
}
