/* Style for German Tutor Application - Flashcards
   Base styles loaded from app.css; navigation from navigation.css */

/* Sidebar layout overrides */
body.sidebar-layout {
    padding-left: calc(var(--sidebar-width) + 24px);
}

@media (max-width: 640px) {
    body.sidebar-layout {
        padding-left: 16px;
    }
}

/* Flashcards Sidebar */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background: rgba(255, 255, 255, 0.98);
    border-right: 1px solid var(--gray-200);
    padding: 20px 16px;
    overflow-y: auto;
    z-index: 950;
    box-shadow: var(--shadow-md);
    transform: translateX(0);
    transition: transform 0.25s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--teal-700);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-link {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease, color 0.2s ease;
    display: block;
}

.sidebar-link-main {
    font-weight: 600;
    font-size: 15px;
    color: var(--teal-700);
    margin-bottom: 8px;
}

.sidebar-link:hover {
    background: var(--teal-50);
    color: var(--teal-700);
}

.sidebar-link.is-active {
    background: var(--teal-100);
    color: var(--teal-700);
    font-weight: 600;
}

.sidebar-section {
    margin-top: 4px;
}

.sidebar-section:first-of-type {
    margin-top: 8px;
}

.sidebar-section-toggle {
    width: 100%;
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-section-toggle:hover {
    background: var(--gray-50);
    color: var(--teal-600);
}

.sidebar-section-link {
    text-decoration: none;
    cursor: pointer;
}

.sidebar-section-link:hover {
    background: var(--gray-50);
    color: var(--teal-600);
}

.sidebar-chevron {
    transition: transform 0.2s ease;
}

.sidebar-section.is-open .sidebar-chevron {
    transform: rotate(90deg);
}

.sidebar-submenu {
    display: none;
    flex-direction: column;
    gap: 2px;
    margin: 4px 0 8px 12px;
    padding-left: 8px;
    border-left: 2px solid var(--teal-100);
}

.sidebar-section.is-open .sidebar-submenu {
    display: flex;
}

.sidebar-submenu .sidebar-link {
    font-weight: 400;
    font-size: 13px;
    padding: 7px 12px;
    color: var(--text-secondary);
}

.sidebar-submenu .sidebar-link:hover {
    color: var(--teal-600);
}

.sidebar-submenu .sidebar-link.is-active {
    color: var(--teal-700);
    font-weight: 500;
}

.sidebar-toggle {
    position: fixed;
    top: 18px;
    left: 18px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1100;
    box-shadow: var(--shadow-sm);
}

.sidebar-toggle-icon {
    font-size: 18px;
}

.sidebar-close {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: none;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 940;
}

@media (max-width: 900px) {
    body.sidebar-layout {
        padding-left: 16px;
    }

    .sidebar {
        transform: translateX(-105%);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    .sidebar-close {
        display: inline-flex;
    }

    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Flashcard specific styles */
.flashcard-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    margin-top: 22px;
}

.flashcard-frame {
    perspective: 1200px;
    width: 400px;
    max-width: 100%;
    height: 250px;
}

.flashcard {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--radius-lg);
    cursor: pointer;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.flashcard-face {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    backface-visibility: hidden;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-xl);
}

.flashcard-front {
    background: linear-gradient(135deg, var(--white) 0%, var(--teal-50) 100%);
    border: 2px solid var(--teal-200);
}

.flashcard-back {
    background: var(--teal-600);
    transform: rotateY(180deg);
    color: white;
    box-shadow: var(--shadow-xl), inset 0 0 40px rgba(255, 255, 255, 0.06);
}

.term-text {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.term-text .verb-name {
    font-size: 20px;
    font-weight: 600;
}

.term-text .erganzung,
.term-text .beispiel {
    font-size: 10px;
    font-weight: 500;
    margin-top: 4px;
}

.meaning-text {
    font-size: 26px;
    font-weight: 700;
    color: white;
    white-space: pre-line;
    line-height: 1.35;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.flashcard-back .muted {
    color: var(--teal-100);
}

.controls-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* New controls row (icon buttons + counters) */
.new-controls-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
}

.new-controls-left,
.new-controls-right {
    display: flex;
    align-items: center;
    justify-content: center;
}

.new-controls-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.action-btn {
    width: 46px;
    height: 46px;
}

@media (max-width: 640px) {
    .new-controls-row {
        grid-template-columns: auto 1fr auto;
        gap: 10px;
    }
    .new-controls-center {
        gap: 12px;
    }
}

/* Flashcard mobile overrides */
@media (max-width: 640px) {
    .flashcard-frame {
        width: 100%;
        height: 220px;
    }

    .term-text {
        font-size: 20px;
    }

    .meaning-text {
        font-size: 20px;
    }
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--gray-200);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-banner[aria-hidden="false"] {
    transform: translateY(0);
}

.cookie-banner-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.cookie-banner-content {
    flex: 1;
    min-width: 300px;
}

.cookie-banner-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cookie-banner-lucide {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--teal-600);
}

.cookie-banner-text {
    font-size: 0.9375rem;
    color: var(--gray-600);
    line-height: 1.7;
}

.cookie-banner-text a {
    color: var(--teal-600);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.cookie-banner-text a:hover {
    color: var(--teal-700);
    text-decoration: underline;
}

.cookie-banner-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.cookie-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9375rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
}

.cookie-btn-primary {
    background: var(--amber-500);
    color: white;
    box-shadow: var(--shadow-amber);
}

.cookie-btn-primary:hover {
    transform: translateY(-2px);
    background: var(--amber-600);
    box-shadow: 0 15px 35px -5px rgba(245, 158, 11, 0.4);
}

.cookie-btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
}

.cookie-btn-secondary:hover {
    border-color: var(--teal-300);
    background: var(--teal-50);
    color: var(--gray-900);
}

@media (max-width: 768px) {
    .cookie-banner-container {
        flex-direction: column;
        align-items: stretch;
        padding: 1.25rem 1.5rem;
    }

    .cookie-banner-actions {
        flex-direction: column;
    }

    .cookie-btn {
        width: 100%;
        text-align: center;
    }
}

/* Footer */
footer {
    padding: 3rem 2rem;
    background: var(--gray-900);
    color: var(--gray-500);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
}

.footer-brand {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--teal-400) 0%, var(--teal-300) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.footer-description {
    color: var(--gray-500);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.footer-title {
    color: white;
    font-weight: 700;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--gray-500);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--teal-400);
}

.footer-bottom {
    max-width: 1200px;
    margin: 3rem auto 0;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-size: 0.875rem;
}

.footer-note {
    margin-top: 1rem;
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Mobile responsive adjustment */
@media (max-width: 768px) {
    .footer-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* Feedback Icon Buttons */
.feedback-buttons {
    display: flex;
    align-items: center;
}

.feedback-icon-btn {
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #6b7280;
    min-width: 44px;
    min-height: 44px;
}

.feedback-icon-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.feedback-icon-btn:focus-visible,
.icon-btn:focus-visible,
.action-btn:focus-visible,
.sidebar-link:focus-visible {
    outline: 2px solid var(--teal-300);
    outline-offset: 2px;
}

.feedback-buttons {
    animation: fadeInButtons 0.3s ease-out;
}

@keyframes fadeInButtons {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Page-specific styles (from flashcards.html) */
.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

@media (max-width: 540px) {
    .flashcard-frame {
        height: 200px;
    }
    .term-text {
        font-size: 18px;
    }
    .meaning-text {
        font-size: 18px;
    }
}

/* Celebration overlay */
.celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.celebration-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.celebration-message {
    background: white;
    padding: 48px 64px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.celebration-overlay.active .celebration-message {
    transform: scale(1);
}

.celebration-message h2 {
    font-size: 42px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--teal-600) 0%, var(--teal-400) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 16px 0;
}

.celebration-message p {
    font-size: 18px;
    color: var(--text-secondary);
    margin: 0;
}

.celebration-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

/* Swipe feedback indicators */
.swipe-indicator {
    position: absolute;
    font-size: 48px;
    font-weight: bold;
    opacity: 0;
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.2s ease;
}

.swipe-indicator.show {
    opacity: 0.9;
}

.swipe-indicator.tick {
    top: 16px;
    right: 16px;
    color: #10b981;
    text-shadow: 0 4px 12px rgba(16, 185, 129, 0.5);
}

.swipe-indicator.cross {
    top: 16px;
    left: 16px;
    color: #ef4444;
    text-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
}

/* Progress Modal Styles */
.progress-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    padding: 24px;
}
.progress-modal.is-open {
    display: flex;
}
.progress-modal-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    width: 600px;
    max-width: 94vw;
    padding: 40px;
    display: flex;
    flex-direction: column;
}
.progress-modal-title {
    font-size: 28px;
    font-weight: 800;
    color: #1a1a1a;
    text-align: center;
    margin: 0 0 32px 0;
}
.progress-section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #666;
    margin-bottom: 12px;
}
.progress-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.progress-percent-large {
    font-size: 32px;
    font-weight: 800;
    color: var(--teal-600);
}

/* New Progress Bar */
.progress-bar-track {
    width: 100%;
    height: 12px;
    background: #F0F0F0;
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 32px;
}
.progress-bar-fill {
    height: 100%;
    background: var(--teal-600);
    border-radius: 99px;
    width: 0%;
    transition: width 1s ease-out;
}

/* Stats Cards */
.progress-stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 0px;
}
.progress-stat-card {
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 90px;
}
.progress-stat-card.known {
    background: #E0FBEF;
}
.progress-stat-card.learning {
    background: #FFF0D9;
}
.stat-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}
.progress-stat-card.known .stat-value { color: #10B981; }
.progress-stat-card.learning .stat-value { color: #14B8A6; }

.stat-label {
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

/* Actions */
.progress-actions {
    display: grid;
    gap: 12px;
}
.progress-btn-primary {
    background: var(--amber-500);
    color: white;
    border: none;
    padding: 18px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    box-shadow: var(--shadow-amber);
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.progress-btn-primary.loading::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 0;
    background: rgba(255, 255, 255, 0.2);
    animation: btnLoading 5s ease-in-out forwards;
    z-index: -1;
}
.progress-btn-secondary {
    background: white;
    color: var(--teal-600);
    border: 2px solid var(--teal-600);
    padding: 16px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
}
.progress-btn-secondary:hover {
    background: #F8F8FF;
}

@keyframes btnLoading {
    0% { width: 0; }
    100% { width: 100%; }
}

/* ── SRS Rating Buttons ── */
.srs-rating-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    width: 100%;
    max-width: 520px;
    margin: 12px auto 0;
}

.srs-btn {
    flex: 1;
    padding: 12px 8px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    font-size: 14px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.srs-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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


.srs-btn-veryhard {
    background: #fecaca;
    color: #1F2937;
}

.srs-btn-hard {
    background: #fed7aa;
    color: #1F2937;
}

.srs-btn-medium {
    background: #fef3c7;
    color: #1F2937;
}

.srs-btn-easy {
    background: #dcfce7;
    color: #1F2937;
}

@media (max-width: 640px) {
    .srs-rating-buttons {
        gap: 6px;
    }
    .srs-btn {
        padding: 10px 4px;
        font-size: 12px;
    }
}
