@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    --bg-primary: #f0f5f3;
    --bg-secondary: #e8f0ec;
    --bg-glass: rgba(255, 255, 255, 0.7);
    --bg-glass-hover: rgba(255, 255, 255, 0.85);

    --accent-primary: #2d6a4f;
    --accent-secondary: #40916c;
    --accent-light: #95d5b2;

    --text-primary: #1b4332;
    --text-secondary: #52796f;
    --text-muted: #74a892;
    --text-inverse: #ffffff;

    --border: rgba(45, 106, 79, 0.15);
    --border-focus: rgba(45, 106, 79, 0.4);
    --shadow: rgba(27, 67, 50, 0.08);
    --shadow-lg: rgba(27, 67, 50, 0.15);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;

    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

#shader-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
}

.blur-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(240, 245, 243, 0.15);
    pointer-events: none;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow:
        0 4px 24px var(--shadow),
        0 1px 2px var(--shadow);
}

.logo {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast),
        background-color var(--transition-fast);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:hover {
    background: rgba(255, 255, 255, 0.8);
}

.form-input:focus {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition:
        transform var(--transition-fast),
        box-shadow var(--transition-base),
        background-color var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.btn:hover::before {
    transform: translateX(100%);
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--text-inverse);
    box-shadow: 0 4px 12px rgba(45, 106, 79, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(45, 106, 79, 0.4);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.625rem 1rem;
}

.btn-ghost:hover {
    background: rgba(45, 106, 79, 0.08);
    color: var(--text-primary);
}

.error-message {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.2);
    color: #a94442;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    animation: shake 0.4s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-5px);
    }

    40%,
    80% {
        transform: translateX(5px);
    }
}

.login-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    animation: fadeInUp 0.6s var(--transition-slow);
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.login-header .logo {
    margin-bottom: 0.5rem;
}

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

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

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

.user-greeting {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

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

.dashboard-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.dashboard-card {
    width: 100%;
    max-width: 800px;
    padding: 3rem;
    text-align: center;
    animation: fadeInUp 0.6s var(--transition-slow);
}

.dashboard-title {
    margin-bottom: 1rem;
}

.dashboard-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto;
}

.stagger-1 {
    animation-delay: 0.1s;
}

.stagger-2 {
    animation-delay: 0.2s;
}

.stagger-3 {
    animation-delay: 0.3s;
}

.stagger-4 {
    animation-delay: 0.4s;
}

.screen {
    display: none;
    width: 100%;
}

.screen.active {
    display: flex;
    justify-content: center;
    animation: fadeInUp 0.5s ease;
}

.section-title {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.section-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.upload-card {
    max-width: 600px;
}

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    transition: all var(--transition-base);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.3);
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent-primary);
    background: rgba(45, 106, 79, 0.05);
}

.upload-zone.drag-over {
    transform: scale(1.02);
}

.upload-icon {
    color: var(--accent-secondary);
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.upload-or {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.upload-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

.btn-secondary {
    background: rgba(45, 106, 79, 0.1);
    color: var(--accent-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(45, 106, 79, 0.15);
    border-color: var(--accent-primary);
}

.file-preview {
    display: none;
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(45, 106, 79, 0.08);
    border-radius: var(--radius-md);
    border: 1px solid var(--accent-light);
}

.file-preview.visible {
    display: block;
    animation: fadeInUp 0.3s ease;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--accent-primary);
}

.file-name {
    flex: 1;
    font-weight: 500;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.btn-analyze {
    margin-top: 1.5rem;
    width: 100%;
}

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

.processing-card {
    max-width: 600px;
    padding: 3rem;
}

.processing-animation {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
}

.pulse-ring {
    position: absolute;
    inset: 0;
    border: 2px solid var(--accent-light);
    border-radius: 50%;
    animation: pulse-ring 2s ease-out infinite;
}

.pulse-ring.delay-1 {
    animation-delay: 0.5s;
}

.pulse-ring.delay-2 {
    animation-delay: 1s;
}

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

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.heart-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--accent-primary);
    animation: heartbeat 1.2s ease-in-out infinite;
}

@keyframes heartbeat {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
}

.processing-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.processing-status {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.progress-container {
    width: 100%;
    height: 6px;
    background: rgba(45, 106, 79, 0.15);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 2rem;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.spectrogram-preview {
    display: none;
    text-align: left;
}

.spectrogram-preview.visible {
    display: block;
    animation: fadeInUp 0.5s ease;
}

.spectrogram-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.spectrogram-image {
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-md);
    padding: 1rem;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spectrogram-image img {
    max-width: 100%;
    border-radius: var(--radius-sm);
}

.spectrogram-placeholder {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.spectrogram-loading {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.report-card {
    max-width: 900px;
    text-align: left;
}

.report-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.report-title {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.report-timestamp {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.report-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.report-section {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.report-section-title {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.audio-player-wrapper {
    margin-bottom: 0.5rem;
}

.audio-player-wrapper audio {
    width: 100%;
    border-radius: var(--radius-md);
}

.audio-filename {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.report-spectrogram {
    background: rgba(0, 0, 0, 0.03);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
}

.report-spectrogram img {
    max-width: 100%;
    border-radius: var(--radius-sm);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.result-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all var(--transition-base);
}

.result-card.positive {
    border-color: var(--accent-light);
    background: rgba(45, 106, 79, 0.08);
}

.result-card.negative {
    border-color: rgba(220, 53, 69, 0.3);
    background: rgba(220, 53, 69, 0.05);
}

.result-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(45, 106, 79, 0.1);
    border-radius: var(--radius-md);
    color: var(--accent-primary);
}

.result-icon.warning {
    background: rgba(255, 193, 7, 0.15);
    color: #f0a500;
}

.result-icon.bpm {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.result-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.result-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.result-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.result-badge {
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--border);
    color: var(--text-muted);
}

.result-badge.detected {
    background: rgba(45, 106, 79, 0.15);
    color: var(--accent-primary);
}

.result-badge.not-detected {
    background: rgba(108, 117, 125, 0.15);
    color: #6c757d;
}

.result-badge.warning {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
}

.report-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.report-actions .btn {
    min-width: 180px;
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 640px) {

    .login-card,
    .dashboard-card {
        padding: 1.75rem;
    }

    .navbar {
        padding: 0 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .logo {
        font-size: 1.5rem;
    }

    .upload-zone {
        padding: 2rem 1rem;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

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

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