/* ==========================================================================
   Wal-O-Mat Styles
   ========================================================================== */

:root {
    --color-ocean-deep: #0b1628;
    --color-ocean-mid: #1a3a5c;
    --color-ocean-light: #2d5a7b;
    --color-surface: #f0f4f8;
    --color-foam: #ffffff;
    --color-accent: #4ecdc4;
    --color-accent-hover: #3db9b0;
    --color-agree: #2ecc71;
    --color-neutral: #95a5a6;
    --color-disagree: #e74c3c;
    --color-text: #2c3e50;
    --color-text-light: #7f8c8d;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.15);
    --radius-small: 8px;
    --radius-medium: 16px;
    --radius-large: 24px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(
        135deg,
        var(--color-ocean-deep) 0%,
        var(--color-ocean-mid) 100%
    );
    min-height: 100vh;
    color: var(--color-text);
}

#app {
    min-height: 100vh;
}

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

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

/* ==========================================================================
   Splash / Landing Page
   ========================================================================== */

/* Global language toggle - fixed in upper right */
.global-language-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
}

.language-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.4rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.flag-button {
    background: transparent;
    border: none;
    padding: 0.15rem;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease,
        background 0.15s ease;
}

.flag-button .flag-icon {
    width: 38px;
    height: 28px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.flag-button:hover {
    background: rgba(255, 255, 255, 0.08);
}

.flag-button.active {
    background: rgba(255, 255, 255, 0.16);
}

.flag-button:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.flag-button.active .flag-icon {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border: 2px solid var(--color-accent);
}

.splash-container {
    max-width: 600px;
    text-align: center;
    color: var(--color-foam);
}

.splash-header .logo-area {
    margin-bottom: 1rem;
}

.splash-header .whale-icon {
    font-size: 4rem;
    display: block;
    animation: float 3s ease-in-out infinite;
}

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

.splash-header h1 {
    font-size: 3.5rem;
    margin: 0;
    font-weight: 700;
}

.splash-header .tagline {
    font-size: 1.5rem;
    opacity: 0.9;
    margin: 0.5rem 0 2rem 0;
}

.disclaimer-box {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-medium);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.disclaimer-box p {
    margin: 0 0 0.75rem 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

.disclaimer-box p:last-child {
    margin-bottom: 0;
}

.disclaimer-box a {
    color: var(--color-accent);
}

.intro-text {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.start-button {
    background: var(--color-accent);
    color: var(--color-ocean-deep);
    border: none;
    padding: 1rem 3rem;
    font-size: 1.25rem;
    font-weight: 600;
    border-radius: var(--radius-large);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-medium);
}

.start-button:hover {
    background: var(--color-accent-hover);
    transform: translateY(-2px);
}

.splash-footer {
    margin-top: 3rem;
}

.splash-footer a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
}

.splash-footer a:hover {
    color: var(--color-foam);
}

/* ==========================================================================
   About Page
   ========================================================================== */

.about-container {
    max-width: 700px;
    background: var(--color-foam);
    border-radius: var(--radius-large);
    padding: 2.5rem;
    box-shadow: var(--shadow-medium);
}

.about-container h1 {
    margin-top: 0;
    color: var(--color-ocean-mid);
}

.about-container h2 {
    color: var(--color-ocean-mid);
    margin-top: 2rem;
}

.about-container section {
    margin-bottom: 1.5rem;
}

.about-container a {
    color: var(--color-accent-hover);
}

.about-container ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.about-container li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.back-link {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-surface);
}

/* ==========================================================================
   Quiz Page
   ========================================================================== */

.loading {
    color: var(--color-foam);
    font-size: 1.25rem;
}

.quiz-container {
    max-width: 600px;
    width: 100%;
    background: var(--color-foam);
    border-radius: var(--radius-large);
    padding: 2rem;
    box-shadow: var(--shadow-medium);
}

.quiz-header {
    margin-bottom: 2rem;
}

.quiz-header .progress {
    display: block;
    text-align: center;
    color: var(--color-text-light);
    margin-bottom: 0.75rem;
}

.progress-bar {
    height: 6px;
    background: var(--color-surface);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--color-accent);
    transition: width 0.3s ease;
}

.question-area {
    text-align: center;
}

.question-text {
    font-size: 1.35rem;
    font-weight: 500;
    line-height: 1.5;
    margin: 0 0 2rem 0;
    color: var(--color-ocean-deep);
}

.answer-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.answer-btn {
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border: 2px solid transparent;
    border-radius: var(--radius-small);
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--color-surface);
    color: var(--color-text);
}

.answer-btn:hover {
    transform: translateX(4px);
}

.answer-btn.agree:hover,
.answer-btn.agree.selected {
    background: var(--color-agree);
    color: white;
    border-color: var(--color-agree);
}

.answer-btn.neutral:hover,
.answer-btn.neutral.selected {
    background: var(--color-neutral);
    color: white;
    border-color: var(--color-neutral);
}

.answer-btn.disagree:hover,
.answer-btn.disagree.selected {
    background: var(--color-disagree);
    color: white;
    border-color: var(--color-disagree);
}

.skip-btn {
    margin-top: 1.5rem;
    background: none;
    border: none;
    color: var(--color-text-light);
    cursor: pointer;
    font-size: 0.95rem;
    text-decoration: underline;
}

.skip-btn:hover {
    color: var(--color-text);
}

.quiz-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-surface);
}

.nav-btn {
    background: none;
    border: 2px solid var(--color-ocean-mid);
    color: var(--color-ocean-mid);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: var(--radius-small);
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    background: var(--color-ocean-mid);
    color: white;
}

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

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

/* ==========================================================================
   Weighting Phase
   ========================================================================== */

.weighting-container,
.selection-container,
.results-container {
    max-width: 700px;
    width: 100%;
    background: var(--color-foam);
    border-radius: var(--radius-large);
    padding: 2rem;
    box-shadow: var(--shadow-medium);
}

.weighting-container header,
.selection-container header,
.results-container header {
    text-align: center;
    margin-bottom: 2rem;
}

.weighting-container h2,
.selection-container h2,
.results-container h2 {
    margin: 0 0 0.5rem 0;
    color: var(--color-ocean-mid);
}

.questions-list {
    max-height: 400px;
    overflow-y: auto;
}

.weight-item {
    padding: 0.75rem;
    border-bottom: 1px solid var(--color-surface);
}

.weight-item label {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
}

.weight-item input[type='checkbox'] {
    width: 20px;
    height: 20px;
    accent-color: var(--color-accent);
}

.weight-item .question-text {
    flex: 1;
    font-size: 0.95rem;
    margin: 0;
    text-align: left;
}

.answer-indicator {
    font-size: 1.25rem;
    font-weight: bold;
}

.answer-indicator.agree {
    color: var(--color-agree);
}
.answer-indicator.neutral {
    color: var(--color-neutral);
}
.answer-indicator.disagree {
    color: var(--color-disagree);
}

/* ==========================================================================
   Whale Selection Phase
   ========================================================================== */

.select-all {
    text-align: right;
    margin-bottom: 1rem;
}

.link-btn {
    background: none;
    border: none;
    color: var(--color-accent-hover);
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.95rem;
}

.whales-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.whale-card {
    position: relative;
    background: var(--color-surface);
    border-radius: var(--radius-medium);
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.whale-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.whale-card.selected {
    border-color: var(--color-accent);
    background: rgba(78, 205, 196, 0.1);
}

.whale-card img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 50%;
}

.whale-card .whale-name {
    display: block;
    margin-top: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.whale-card .check-indicator {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    color: var(--color-accent);
    font-size: 1.25rem;
}

/* ==========================================================================
   Results Phase
   ========================================================================== */

.results-list {
    margin-bottom: 2rem;
}

.result-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--color-surface);
    border-radius: var(--radius-small);
    margin-bottom: 0.75rem;
}

.result-card.top-match {
    background: linear-gradient(
        135deg,
        rgba(78, 205, 196, 0.2),
        rgba(78, 205, 196, 0.05)
    );
    border: 2px solid var(--color-accent);
}

.result-card .rank {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-ocean-mid);
    min-width: 50px;
    text-align: center;
}

.result-card.top-match .rank {
    color: var(--color-accent-hover);
}

.result-card img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 50%;
}

.result-info {
    flex: 1;
}

.result-info .whale-name {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.match-bar {
    height: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.match-fill {
    height: 100%;
    background: var(--color-accent);
    transition: width 0.5s ease;
}

.match-percent {
    font-size: 0.9rem;
    color: var(--color-text-light);
}

/* Footer buttons */
.weighting-container footer,
.selection-container footer,
.results-container footer {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-surface);
}

.primary-btn {
    background: var(--color-accent);
    color: var(--color-ocean-deep);
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: var(--radius-small);
    cursor: pointer;
    transition: all 0.2s ease;
}

.primary-btn:hover:not(:disabled) {
    background: var(--color-accent-hover);
}

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

.secondary-btn {
    background: none;
    border: 2px solid var(--color-ocean-mid);
    color: var(--color-ocean-mid);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: var(--radius-small);
    cursor: pointer;
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    background: var(--color-ocean-mid);
    color: white;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 640px) {
    .main-content {
        padding: 1rem;
    }

    .splash-header h1 {
        font-size: 2.5rem;
    }

    .quiz-container,
    .weighting-container,
    .selection-container,
    .results-container {
        padding: 1.5rem;
    }

    .question-text {
        font-size: 1.15rem;
    }

    .whales-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================================================
   Blazor Error UI
   ========================================================================== */

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.2);
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    display: none;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
