/* ═══════════════════════════════════════════════════════════
   MemAnki Web App - Paper & Ink Theme
   Общие стили для всех страниц
   ═══════════════════════════════════════════════════════════ */

/* Fonts - same as landing */
@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url(/fonts/playfair-cyrillic.woff2) format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url(/fonts/playfair-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Source Sans 3';
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url(/fonts/sourcesans-cyrillic.woff2) format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: 'Source Sans 3';
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url(/fonts/sourcesans-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --bg: #FAFAF8;
    --bg-card: #FFFFFF;
    --text: #1A1A1A;
    --text-muted: #6B6B6B;
    --accent: #C4654A;
    --accent-hover: #A8523B;
    --accent-light: rgba(196, 101, 74, 0.08);
    --line: #E5E5E3;
    --success: #2D7D46;
    --success-light: rgba(45, 125, 70, 0.08);
    --error: #C4544A;
    --error-light: rgba(196, 84, 74, 0.08);
    --warning: #B8860B;
    --warning-light: rgba(184, 134, 11, 0.08);
}

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

body {
    font-family: 'Source Sans 3', -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 16px;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ═══════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════ */

header {
    padding: 24px 0;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-family: 'Playfair Display', serif;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--text);
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 32px;
}

.nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
}

.nav a:hover {
    color: var(--text);
}

.nav a.active {
    color: var(--text);
}

.nav a.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 15px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s;
}

.user-menu:hover {
    background: var(--line);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-muted);
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
    margin-left: 4px;
}

.logout-btn:hover {
    color: var(--error);
}

.logout-btn svg {
    width: 18px;
    height: 18px;
}

/* ═══════════════════════════════════════════════════════════
   MAIN
   ═══════════════════════════════════════════════════════════ */

main {
    padding: 48px 0;
    min-height: calc(100vh - 180px);
}

.page-header {
    margin-bottom: 32px;
}

.page-title {
    font-family: 'Playfair Display', serif;
    font-size: 42px;
    font-weight: 400;
    letter-spacing: -1px;
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 17px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 24px;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--text);
}

/* ═══════════════════════════════════════════════════════════
   SECTION
   ═══════════════════════════════════════════════════════════ */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 24px;
}

.section-title {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
}

.section-count {
    font-family: 'Playfair Display', serif;
    font-size: 14px;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════
   STATS BAR
   ═══════════════════════════════════════════════════════════ */

.stats-bar {
    display: flex;
    gap: 48px;
    padding: 24px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    margin-bottom: 48px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-family: 'Playfair Display', serif;
    font-size: 32px;
    font-weight: 400;
    color: var(--text);
}

.stat-value.accent {
    color: var(--accent);
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    padding: 12px 24px;
    border: 2px solid var(--text);
    color: var(--text);
    background: transparent;
    transition: all 0.3s ease;
    cursor: pointer;
    letter-spacing: 0.3px;
}

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

.btn-accent {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-accent:hover {
    background: var(--accent);
    color: white;
}

.btn-filled {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

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

.btn-large {
    padding: 16px 40px;
    font-size: 16px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

.btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
}

.btn:hover svg {
    transform: translateX(3px);
}

/* ═══════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════ */

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

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

.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--line);
    background: var(--bg-card);
    font-family: inherit;
    font-size: 16px;
    color: var(--text);
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
}

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

textarea.form-input {
    min-height: 120px;
    resize: vertical;
}

/* ═══════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════ */

.card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    padding: 24px;
    transition: all 0.3s ease;
}

.card:hover {
    border-color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════
   PROGRESS
   ═══════════════════════════════════════════════════════════ */

.progress-bar {
    height: 4px;
    background: var(--line);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* ═══════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════ */

footer {
    padding: 32px 0;
    border-top: 1px solid var(--line);
    text-align: center;
}

footer p {
    font-size: 14px;
    color: var(--text-muted);
}

footer a {
    color: var(--accent);
    text-decoration: none;
}

/* ═══════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════ */

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-fade-up {
    animation: fadeUp 0.5s ease forwards;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

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

    .nav {
        gap: 20px;
    }

    .page-title {
        font-size: 32px;
    }

    .stats-bar {
        flex-wrap: wrap;
        gap: 24px;
    }

    .stat-value {
        font-size: 28px;
    }
}

/* ═══════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    padding: 32px;
    max-width: 480px;
    width: 90%;
    border: 1px solid var(--line);
    transform: translateY(20px);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 24px;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.modal-wide {
    max-width: 560px;
}

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

.modal-header .modal-title {
    margin-bottom: 0;
}

.btn-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

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

/* ═══════════════════════════════════════════════════════════
   SHARING
   ═══════════════════════════════════════════════════════════ */

.sharing-section {
    padding-bottom: 16px;
}

.share-link-card {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.share-link-header {
    margin-bottom: 12px;
}

.share-link-info {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.share-link-icon {
    font-size: 20px;
    line-height: 1;
}

.share-link-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
}

.share-link-desc {
    font-size: 13px;
    color: var(--text-muted);
}

.share-link-actions {
    margin-top: 12px;
}

.share-link-url {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.link-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-card);
}

.share-link-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-danger {
    border-color: var(--error);
    color: var(--error);
}

.btn-danger:hover {
    background: var(--error-light);
}

/* Members list */
.members-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.member-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--accent);
}

.member-name {
    font-weight: 500;
    font-size: 14px;
}

.member-meta {
    font-size: 12px;
    color: var(--text-muted);
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
}

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

.toast-error {
    background: var(--error);
}
