/* ===========================================
   CRAFT A PLUSHIE - WIKI THEME
   =========================================== */

:root {
    --bg-dark: #0d1117;
    --bg-card: #161b22;
    --bg-card-hover: #1c2333;
    --bg-input: #0d1117;
    --border: #30363d;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --text-link: #58a6ff;
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --success: #3fb950;
    --warning: #d29922;
    --danger: #f85149;
    --info: #58a6ff;

    /* Rarity colors */
    --common: #b0b0b0;
    --uncommon: #4ade80;
    --rare: #60a5fa;
    --epic: #c084fc;
    --legendary: #fbbf24;
    --mythical: #f472b6;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===========================================
   HEADER
   =========================================== */
.wiki-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
    text-decoration: none;
}
.header-brand:hover { text-decoration: none; color: var(--accent); }
.brand-icon { font-size: 1.4rem; }
.brand-text small { font-weight: 400; color: var(--text-muted); font-size: 0.75rem; margin-left: 0.25rem; }

.header-nav {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    flex: 1;
    scrollbar-width: thin;
}
.header-nav a {
    color: var(--text-muted);
    padding: 0.4rem 0.65rem;
    border-radius: 6px;
    font-size: 0.82rem;
    white-space: nowrap;
    transition: all 0.15s;
}
.header-nav a:hover { background: var(--bg-card-hover); color: var(--text); text-decoration: none; }
.header-nav a.active { background: var(--accent); color: #fff; }

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.user-badge {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.user-badge small { font-size: 0.7rem; }

/* ===========================================
   LAYOUT
   =========================================== */
.wiki-body {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.wiki-content { min-height: 60vh; }

.wiki-footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

/* ===========================================
   TYPOGRAPHY
   =========================================== */
h1 { font-size: 2rem; margin-bottom: 0.75rem; color: var(--text); }
h2 { font-size: 1.5rem; margin: 2rem 0 0.75rem; color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
h3 { font-size: 1.2rem; margin: 1.5rem 0 0.5rem; color: var(--text); }
h3 small { font-weight: 400; color: var(--text-muted); font-size: 0.85rem; }
p { margin-bottom: 0.75rem; }
.lead { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 1.5rem; }

/* ===========================================
   TABLES
   =========================================== */
.wiki-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.88rem;
}
.wiki-table th,
.wiki-table td {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    text-align: left;
}
.wiki-table th {
    background: var(--bg-card);
    font-weight: 600;
    color: var(--text);
    position: sticky;
    top: 56px;
}
.wiki-table tbody tr:hover { background: var(--bg-card-hover); }
.wiki-table.compact td,
.wiki-table.compact th { padding: 0.35rem 0.6rem; font-size: 0.82rem; }
.text-right { text-align: right; }
.text-success { color: var(--success); font-weight: 600; }

/* ===========================================
   RARITY BADGES
   =========================================== */
.rarity-common { color: var(--common); font-weight: 600; }
.rarity-uncommon { color: var(--uncommon); font-weight: 600; }
.rarity-rare { color: var(--rare); font-weight: 600; }
.rarity-epic { color: var(--epic); font-weight: 600; }
.rarity-legendary { color: var(--legendary); font-weight: 600; }
.rarity-mythical { color: var(--mythical); font-weight: 600; }

/* ===========================================
   BUTTONS
   =========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    color: #fff;
}
.btn:hover { text-decoration: none; opacity: 0.9; }
.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: #30363d; color: var(--text); }
.btn-success { background: var(--success); }
.btn-warning { background: var(--warning); color: #000; }
.btn-danger { background: var(--danger); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg-card-hover); }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.78rem; }

/* ===========================================
   FORMS
   =========================================== */
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text);
    font-size: 0.9rem;
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}
.input-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.78rem;
    width: 140px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--text);
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}
.form-row .form-group { flex: 1; min-width: 150px; }

/* ===========================================
   ALERTS
   =========================================== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.88rem;
}
.alert-error { background: rgba(248, 81, 73, 0.15); border: 1px solid var(--danger); color: var(--danger); }
.alert-success { background: rgba(63, 185, 80, 0.15); border: 1px solid var(--success); color: var(--success); }

/* ===========================================
   LOGIN PAGE
   =========================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}
.login-container {
    width: 100%;
    max-width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
}
.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}
.login-header h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.login-subtitle { color: var(--text-muted); font-size: 0.9rem; }
.login-logo { width: 80px; height: 80px; border-radius: 12px; margin-bottom: 0.75rem; }
.login-footer { text-align: center; color: var(--text-muted); font-size: 0.78rem; margin-top: 1.25rem; }

/* ===========================================
   ADMIN
   =========================================== */
.admin-panel { }
.admin-section { margin-top: 2rem; }
.admin-form { background: var(--bg-card); padding: 1.25rem; border-radius: 8px; border: 1px solid var(--border); }
.actions-cell { white-space: nowrap; }
.actions-cell form { margin-right: 0.25rem; }
.row-disabled { opacity: 0.5; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-admin { background: var(--accent); color: #fff; }
.badge-editor { background: var(--info); color: #000; }
.badge-viewer { background: var(--border); color: var(--text); }

.status-active { color: var(--success); font-weight: 600; }
.status-inactive { color: var(--danger); font-weight: 600; }
.text-muted { color: var(--text-muted); }

/* ===========================================
   HOME GRID
   =========================================== */
.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}
.home-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    transition: all 0.2s;
    color: var(--text);
}
.home-card:hover {
    text-decoration: none;
    border-color: var(--accent);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
}
.home-card h3 { font-size: 1.05rem; margin-bottom: 0.4rem; color: var(--accent); }
.home-card p { font-size: 0.82rem; color: var(--text-muted); margin: 0; }

/* ===========================================
   INFO BOXES
   =========================================== */
.info-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--info);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
}
.info-box h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.info-box ul { padding-left: 1.25rem; }
.info-box li { margin-bottom: 0.3rem; font-size: 0.88rem; }
.info-box.info-tip { border-left-color: var(--success); }
.info-box.info-warning { border-left-color: var(--warning); }

/* ===========================================
   TOC
   =========================================== */
.toc {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    display: inline-block;
}
.toc h3 { font-size: 0.9rem; margin-bottom: 0.5rem; }
.toc ul { list-style: none; padding-left: 0; }
.toc li { margin-bottom: 0.2rem; }
.toc a { font-size: 0.85rem; }

/* ===========================================
   WIKI ICONS / IMAGES
   =========================================== */
.wiki-icon-sm { width: 24px; height: 24px; object-fit: contain; vertical-align: middle; margin-right: 0.3rem; }
.wiki-icon-md { width: 40px; height: 40px; object-fit: contain; vertical-align: middle; }
.wiki-icon-lg { width: 48px; height: 48px; object-fit: contain; vertical-align: middle; margin-right: 0.4rem; }
.wiki-icon-xl { width: 64px; height: 64px; object-fit: contain; vertical-align: middle; }
.wiki-icon-table { width: 36px; height: 36px; object-fit: contain; vertical-align: middle; }
.wiki-icon-toy { width: 42px; height: 42px; object-fit: contain; vertical-align: middle; border-radius: 4px; }
.wiki-icon-machine { width: 50px; height: 50px; object-fit: contain; vertical-align: middle; border-radius: 6px; }
.home-card-icon { width: 36px; height: 36px; object-fit: contain; margin-bottom: 0.5rem; }

/* ===========================================
   LOOT SECTIONS
   =========================================== */
.loot-section {
    margin-bottom: 2rem;
}
.loot-table { max-width: 900px; }

/* ===========================================
   RESPONSIVE
   =========================================== */
@media (max-width: 768px) {
    .wiki-header { flex-wrap: wrap; height: auto; padding: 0.75rem 1rem; }
    .header-nav { order: 3; width: 100%; padding: 0.5rem 0; }
    .wiki-body { padding: 1rem; }
    .form-row { flex-direction: column; }
    .form-row .form-group { min-width: auto; }
    h1 { font-size: 1.5rem; }
}

/* ===========================================
   SCROLLBAR
   =========================================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #484f58; }
