:root {
    --font-sans: "Inter", sans-serif;
    --text-color: rgb(25, 25, 24);
    --bg-color: #fafafa;
    --border-color: rgba(55, 53, 47, 0.12);
    --space-8: 8px;
    --space-12: 12px;
    --space-16: 16px;
    --space-20: 20px;
    --space-24: 24px;
    --space-32: 32px;

    /* App Specific */
    --text-color-light: rgba(25, 25, 24, 0.6);
    --hover-bg: rgba(55, 53, 47, 0.08);
    --primary-color: #2383E2;
    --primary-hover: #1B6DC1;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: var(--font-sans);
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--space-32) var(--space-24);
}

/* ========== APP HEADER ========== */
.app-header {
    text-align: center;
    margin-bottom: var(--space-24);
    padding: var(--space-16) var(--space-24);
    margin: calc(-1 * var(--space-32)) calc(-1 * var(--space-24)) var(--space-24);
}

.app-header__title {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.025em;
    color: var(--text-color);
    margin: 0;
    padding-bottom: var(--space-16);
}

.app-header__title::after {
    content: "";
    display: block;
    width: 40%;
    height: 1px;
    background: var(--border-color);
    margin: var(--space-16) auto 0;
}

/* Sections */
section {
    margin-bottom: 40px;
}

.card {
    background: white;
    border: 0.5px solid var(--border-color);
    border-radius: 8px;
    padding: 32px;
    box-shadow: var(--card-shadow);
}

h2 {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin-bottom: 16px;
}

p.description {
    font-size: 18px;
    color: var(--text-color-light);
    margin-bottom: 24px;
}

/* Forms */
.form-group {
    margin-bottom: 24px;
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-color-light);
}

.input-options {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.input-option-btn {
    flex: 1;
    height: 40px;
    padding: 10px 16px;
    border: 0.5px solid var(--border-color);
    background: white;
    border-radius: 50px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s, border-color 0.2s;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-option-btn:hover {
    background: var(--hover-bg);
}

.input-option-btn.active {
    border-color: var(--border-color);
    background: rgba(55, 53, 47, 0.12);
    color: var(--text-color);
}

.input-area {
    margin-bottom: 24px;
}

textarea,
input[type="text"],
select {
    width: 100%;
    padding: 12px;
    border: 0.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
}

textarea {
    min-height: 200px;
    resize: vertical;
}

.primary-button {
    font-size: 16px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 50px;
    background: #000000;
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    font-family: "Inter";
}

.primary-button:hover {
    background: #1a1a1a;
}

.primary-button:disabled {
    background: rgba(0, 0, 0, 0.3);
    opacity: 0.5;
    cursor: not-allowed;
}

/* Flashcard Styles */
.flashcards-container {
    perspective: 1000px;
    margin-bottom: 32px;
    min-height: 300px;
}

.flashcard {
    position: relative;
    width: 100%;
    height: 300px;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    cursor: pointer;
}

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

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    border: 0.5px solid var(--border-color);
    border-radius: 12px;
    background: white;
    box-shadow: var(--card-shadow);
}

.flashcard-back {
    transform: rotateY(180deg);
    background-color: #f9f9f9;
}

.card-content-text {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-color);
}

.flashcard-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
}

.nav-btn {
    background: transparent;
    border: 0.5px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

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

.progress-text {
    font-size: 14px;
    color: var(--text-color-light);
}

/* Loading state */
.loading {
    display: none;
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--hover-bg);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.hidden {
    display: none !important;
}

.error-message {
    color: #e03131;
    background: #fff5f5;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 24px;
    border: 0.5px solid #ffc9c9;
}

.file-input-container {
    border: 1px dashed rgba(55, 53, 47, 0.16);
    padding: 40px;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
}

.file-input-container:hover {
    background: var(--hover-bg);
}

.view-toggle {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.list-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.list-card {
    padding: 20px;
    border: 0.5px solid var(--border-color);
    border-radius: 8px;
}

.list-card-front {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.list-card-back {
    color: var(--text-color);
}

@media (max-width: 768px) {
    .container {
        padding: var(--space-24) var(--space-16);
    }

    .app-header {
        padding: var(--space-12) var(--space-16);
        margin: calc(-1 * var(--space-24)) calc(-1 * var(--space-16)) var(--space-20);
    }

    .app-header__title {
        font-size: 28px;
    }
}