/* =========================================
   MY BOARDS — Whiteboard board management page
   ========================================= */

:root {
    --bg-primary: #f8f9fb;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f4ff;
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --border: #e5e7eb;
    --border-hover: #6366f1;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-light: #eef2ff;
    --accent-glow: rgba(99, 102, 241, 0.25);
    --pink: #ec4899;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --radius: 16px;
    --radius-sm: 10px;
    --font: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    --glass: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.25);
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
}

[data-theme="dark"] {
    --bg-primary: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #252540;
    --text-primary: #f0f0f5;
    --text-secondary: #9ca3af;
    --text-tertiary: #6b7280;
    --border: #2d2d44;
    --border-hover: #818cf8;
    --accent: #818cf8;
    --accent-hover: #6366f1;
    --accent-light: #1e1b4b;
    --accent-glow: rgba(129, 140, 248, 0.25);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
    --glass: rgba(26, 26, 46, 0.8);
    --glass-border: rgba(255, 255, 255, 0.08);
}

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

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

/* ── Header ─────────────────────────────────── */
.wb-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    border-bottom: 1px solid var(--glass-border);
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.wb-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.wb-header-left a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s;
}

.wb-header-left a:hover {
    color: var(--accent);
}

.wb-header-divider {
    width: 1px;
    height: 22px;
    background: var(--border);
}

.wb-header-logo {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.wb-header h1 {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.wb-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ── Theme toggle ───────────────────────────── */
.theme-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 18px;
    transition: all 0.15s;
}

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

/* ── Page container ─────────────────────────── */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 32px 64px;
}

/* ── Top bar ────────────────────────────────── */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 32px;
}

.top-bar-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.top-bar-left h2 {
    font-size: 28px;
    font-weight: 800;
}

.board-total {
    font-size: 14px;
    color: var(--text-tertiary);
    font-weight: 600;
}

.quota-badge {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 600;
    background: var(--surface-hover);
    padding: 3px 10px;
    border-radius: 12px;
    letter-spacing: 0.02em;
}

.quota-badge.quota-full {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ── Search ─────────────────────────────────── */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box svg {
    position: absolute;
    left: 12px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-box input {
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    width: 240px;
    transition: border-color 0.15s;
}

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

.search-box input::placeholder {
    color: var(--text-tertiary);
}

/* ── Sort select ────────────────────────────── */
.sort-select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.15s;
}

.sort-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* ── New board button ───────────────────────── */
.btn-new {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.btn-new:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-new svg {
    width: 16px;
    height: 16px;
}

.btn-new.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: auto;
    transform: none;
    box-shadow: none;
}

.btn-new.disabled:hover {
    transform: none;
    background: var(--accent);
}

/* ── Anon notice ────────────────────────────── */
.anon-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    background: var(--accent-light);
    border: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.anon-notice a {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

.anon-notice a:hover {
    text-decoration: underline;
}

.claimed-toast {
    color: var(--success);
    font-weight: 700;
}

/* ── Date group ─────────────────────────────── */
.date-group {
    margin-bottom: 36px;
}

.date-group-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* ── Board grid ─────────────────────────────── */
.board-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.board-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.board-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.board-card-thumb {
    width: 100%;
    aspect-ratio: 16/10;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.board-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.placeholder-icon {
    color: var(--text-tertiary);
}

.board-card-info {
    padding: 12px 14px 8px;
}

.board-card-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.board-card-meta {
    font-size: 12px;
    color: var(--text-tertiary);
}

.board-card-actions {
    display: flex;
    gap: 4px;
    padding: 4px 14px 12px;
    opacity: 0;
    transition: opacity 0.15s;
}

.board-card:hover .board-card-actions {
    opacity: 1;
}

.board-card-actions button {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
    font-family: var(--font);
}

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

.board-card-actions .btn-del:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ── Empty state ────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 64px 20px;
    color: var(--text-tertiary);
}

.empty-state svg {
    margin-bottom: 16px;
    color: var(--border);
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
}

.empty-state .btn-new {
    font-size: 14px;
}

/* ── Flash ──────────────────────────────────── */
.flash-notice {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    color: var(--text-primary);
    z-index: 200;
    animation: fadeInUp 0.3s ease-out;
    display: none;
}

/* ── Loading ────────────────────────────────── */
.loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin: 64px auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* ── Noscript fallback ──────────────────────── */
.noscript-msg {
    padding: 40px;
    text-align: center;
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 768px) {
    .wb-header {
        padding: 14px 16px;
    }

    .page-container {
        padding: 20px 16px 48px;
    }

    .top-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .top-bar-right {
        flex-direction: column;
    }

    .search-box input {
        width: 100%;
    }

    .board-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .board-grid {
        grid-template-columns: 1fr 1fr;
    }
}