/* Minimalist Theme */
:root {
    --bg: #000000;
    --surface: #0a0a0a;
    --card: #111111;
    --border: #333333;
    --accent: #ffffff;
    --accent2: #ffffff;
    --accent3: #ffffff;
    --green: #c5e1a5;
    /* Pastel Matcha Green */
    --red: #f8bbd0;
    /* Pastel Pink */
    --text: #ffffff;
    --muted: #888888;
    --radius: 8px;
    --amber: #fbbf24;
}

body[data-theme="matcha"] {
    --bg: #F4F1DE;
    --surface: #E0E5D3;
    --card: #FDFCF7;
    --text: #3D4035;
    --muted: #8A8F79;
    --border: #D1D6C4;
    --primary: #A3B18A;
    --primary-hover: #588157;
    --green: #588157;
    --red: #E07A5F;
    --amber: #E0A96D;
}

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

body {
    font-family: 'Syne', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

.app {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px 60px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeDown 0.6s ease both;
}

.logo {
    font-size: 12px;
    font-family: 'Space Mono', monospace;
    color: var(--muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

h1 {
    font-size: 36px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 8px;
    letter-spacing: -1px;
}

.subtitle {
    color: var(--muted);
    font-size: 13px;
    font-family: 'Space Mono', monospace;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    animation: fadeDown 0.6s 0.1s ease both;
}

.tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid transparent;
}

.tab.active {
    color: var(--text);
    border-bottom-color: var(--text);
}

/* Stats bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
    animation: fadeDown 0.6s 0.2s ease both;
}

.stat {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    background: var(--surface);
}

.stat-val {
    font-size: 24px;
    font-weight: 400;
    font-family: 'Space Mono', monospace;
}

.stat-val.green {
    color: var(--green);
}

.stat-val.red {
    color: var(--red);
}

.stat-val.amber {
    color: var(--text);
}

.stat-label {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
    font-family: 'Space Mono', monospace;
}

/* FLASHCARD MODE */
.flashcard-container {
    animation: fadeUp 0.4s ease both;
}

.filter-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.pill {
    padding: 6px 14px;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-family: 'Space Mono', monospace;
    cursor: pointer;
    transition: all 0.2s;
}

.pill.active {
    border-color: var(--text);
    color: var(--bg);
    background: var(--text);
}

.card-wrap {
    perspective: 1000px;
    height: 280px;
    margin-bottom: 24px;
    cursor: pointer;
}

.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-wrap.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    inset: 0;
    border-radius: 6px;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backface-visibility: hidden;
    padding: 32px;
    gap: 16px;

    /* Simulacion de Tarjeta de Papel */
    background-color: #fdfdfd;
    box-shadow:
        0 12px 24px rgba(0, 0, 0, 0.8),
        inset 0 0 20px rgba(0, 0, 0, 0.02);
    background-image: repeating-linear-gradient(transparent,
            transparent 31px,
            #eeeeee 31px,
            #eeeeee 32px);
}

/* Paper Contrast Overrides */
.card-face .verb-main,
.card-face .conj-val,
.card-face .conj-meaning,
.card-face .btn-icon {
    color: #111111;
}

.card-face .verb-hint,
.card-face .flip-hint,
.card-face .conj-label {
    color: #888888;
}

.card-face .conj-meaning {
    border-top: 1px dashed #dcdcdc;
}

.card-face .verb-type.phrasal {
    background: #111111;
    color: #ffffff;
}

.type-color-regular {
    color: var(--green) !important;
}

.type-color-irregular {
    color: var(--red) !important;
}

.type-color-phrasal {
    color: #111111 !important;
}

.card-back {
    transform: rotateY(180deg);
}

.fc-example {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
}

.fc-example .en {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    color: #111;
    font-size: 13px;
    margin-bottom: 4px;
}

.fc-example .es {
    font-family: 'Space Mono', monospace;
    color: #666;
    font-size: 11px;
}

.verb-type {
    font-size: 10px;
    font-family: 'Space Mono', monospace;
    padding: 4px 12px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.verb-type.regular {
    color: var(--bg);
    background: var(--green);
    border: none;
}

.verb-type.irregular {
    color: var(--bg);
    background: var(--red);
    border: none;
}

.verb-type.phrasal {
    color: var(--bg);
    background: var(--text);
    border: none;
}

.verb-main {
    font-size: 48px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.verb-hint {
    font-size: 13px;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
}

.flip-hint {
    font-size: 10px;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 16px;
}

.conjugation-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    width: 100%;
}

.conj-item {
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.conj-label {
    font-size: 10px;
    font-family: 'Space Mono', monospace;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.conj-val {
    font-size: 14px;
    color: var(--text);
    font-family: 'Space Mono', monospace;
}

.conj-meaning {
    font-size: 14px;
    color: var(--text);
    margin-top: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Space Mono', monospace;
}

.card-nav {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    border-radius: var(--radius);
    border: 1px solid var(--text);
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: transparent;
    color: var(--text);
}

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

.btn-primary {
    background: var(--text);
    color: var(--bg);
}

.btn-primary:hover {
    background: transparent;
    color: var(--text);
}

.card-counter {
    font-size: 12px;
    font-family: 'Space Mono', monospace;
    color: var(--muted);
    min-width: 60px;
    text-align: center;
}

/* QUIZ MODE */
.quiz-container {
    animation: fadeUp 0.4s ease both;
}

.question-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 24px;
    margin-bottom: 24px;
    text-align: center;
}

.question-label {
    font-size: 11px;
    font-family: 'Space Mono', monospace;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.question-verb {
    font-size: 48px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
}

.question-context {
    font-size: 12px;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.option-btn {
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.option-btn:hover:not(.answered) {
    border-color: var(--text);
}

.option-btn.correct {
    background: var(--green);
    border-color: var(--green);
    color: var(--bg);
}

.option-btn.wrong {
    background: var(--red);
    border-color: var(--red);
    color: var(--bg);
}

/* LIST MODE */
.list-container {
    animation: fadeUp 0.4s ease both;
}

.search-input {
    width: 100%;
    padding: 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    margin-bottom: 20px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--text);
}

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

.verb-table {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.table-header {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr 1fr 0.8fr;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-size: 10px;
    font-family: 'Space Mono', monospace;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    background: var(--surface);
}

.table-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr 1fr 0.8fr;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    transition: background 0.2s;
    align-items: center;
}

.table-row:hover {
    background: var(--surface);
}

.table-row:last-child {
    border-bottom: none;
}

.table-row .base {
    font-weight: 700;
    color: var(--text);
}

.table-row .past {
    color: var(--text);
    font-family: 'Space Mono', monospace;
}

.table-row .participle {
    color: var(--muted);
    font-family: 'Space Mono', monospace;
}

.table-row .meaning {
    color: var(--muted);
}

/* Progress bar */
.progress-bar {
    height: 2px;
    background: var(--border);
    margin-bottom: 24px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--text);
    transition: width 0.4s ease;
}

/* PROGRESS MODE */
.progress-container {
    animation: fadeUp 0.4s ease both;
}

.progress-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.rank-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: pop 0.5s ease;
}

.rank-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.rank-xp {
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    color: var(--green);
    margin-bottom: 24px;
}

.xp-bar-wrap {
    width: 100%;
    height: 8px;
    background: var(--surface);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 8px;
    border: 1px solid var(--border);
}

.xp-bar-fill {
    height: 100%;
    background: var(--green);
    width: 0%;
    transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.xp-hint {
    font-size: 11px;
    font-family: 'Space Mono', monospace;
    color: var(--muted);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: var(--bg);
    border-radius: 100px;
    padding: 12px 24px;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.correct-toast {
    background: var(--green);
    color: var(--bg);
}

.toast.wrong-toast {
    background: var(--red);
    color: var(--bg);
}

/* Animations */
@keyframes fadeDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

@keyframes pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

.pop {
    animation: pop 0.3s ease;
}

.verb-main-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    transition: transform 0.2s;
    padding: 8px;
    border-radius: 50%;
}

.btn-icon:hover {
    transform: scale(1.1);
    background: var(--border);
}

/* User Menu Dropdown */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 170px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
    z-index: 100;
    overflow: hidden;
    animation: fadeDown 0.2s ease;
}

.dropdown-menu.show {
    display: flex;
    flex-direction: column;
}

.dropdown-item {
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-item:hover {
    background: var(--surface);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    animation: fadeDown 0.2s ease;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 400px;
    padding: 24px;
}

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

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: .3s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 4px;
    bottom: 4px;
    background-color: var(--text);
    transition: .3s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--green);
}

input:checked+.slider:before {
    transform: translateX(18px);
    background-color: var(--bg);
}