/* ===================================================
   Fantaskr Admin Dashboard — Custom Styles
   Layered on top of Bootstrap 5
   =================================================== */

/* ===== Brand CSS Variables (fallbacks; overridden by applyBrandColors()) ===== */
:root {
    --brand-primary:       #F55C1B;
    --brand-primary-dark:  #C94A13;
    --brand-primary-light: #1DCFED;
    --brand-secondary:     #1DCFED;
    --brand-accent:        #F0A500;
    --sidebar-bg:          #1a1f2e;
    --sidebar-border:      #252b3b;
    --sidebar-text:        #8a94a8;
    --sidebar-text-hover:  #c8d0e0;
    --topbar-bg:           #ffffff;
    --content-bg:          #f0f2f5;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Arial, sans-serif; background: var(--content-bg); }

/* ===== App Layout ===== */
#app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
#sidebar {
    width: clamp(200px, 17vw, 250px);
    min-height: 100vh;
    background: #ffffff;
    color: #64748b;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

#sidebar-header {
    padding: 1.25rem 1rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.sidebar-wordmark-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.sidebar-wordmark {
    font-size: 1.1rem;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.02em;
    line-height: 1;
}

.fantaskr-wordmark-img {
    height: 22px;
    width: auto;
    display: block;
}

.sidebar-admin-tag {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    margin-top: 1px;
}

#sidebar-brand-logo {
    height: 36px;
    width: auto;
    display: block;
    max-width: 100%;
}

/* ===== Sidebar Nav ===== */
#sidebar-nav {
    flex: 1;
    padding: 0.5rem 0;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 1.25rem;
    color: #64748b;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    background: none;
    border-top: none;
    border-right: none;
    border-bottom: none;
    width: 100%;
    text-align: left;
}

.sidebar-nav-item:hover {
    color: #1e293b;
    background: #f8fafc;
    border-left-color: #e2e8f0;
    text-decoration: none;
}

.sidebar-nav-item.active {
    color: var(--brand-primary);
    background: rgba(245, 92, 27, 0.07);
    border-left-color: var(--brand-primary);
    font-weight: 600;
}

.sidebar-nav-item i {
    font-size: 1rem;
    width: 1.1rem;
    text-align: center;
    flex-shrink: 0;
}

/* ===== Sidebar Footer ===== */
#sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #e2e8f0;
}

#sidebar-plan-badge {
    display: block;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    margin-bottom: 0.75rem;
}

.plan-badge-starter {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.plan-badge-pro {
    background: rgba(245, 92, 27, 0.08);
    color: var(--brand-primary);
    border: 1px solid rgba(245, 92, 27, 0.3);
}

.plan-badge-enterprise {
    background: rgba(29, 207, 237, 0.1);
    color: #0ba8c4;
    border: 1px solid rgba(29, 207, 237, 0.35);
}

#preview-site-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    margin-bottom: 0.6rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffffff;
    background: var(--brand-primary);
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.15s;
}
#preview-site-btn:hover {
    background: var(--brand-primary-dark);
    color: #ffffff;
    text-decoration: none;
}

.sidebar-devtools-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    color: #94a3b8;
    font-size: 0.75rem;
    text-decoration: none;
    padding: 0.3rem;
    border-radius: 4px;
    transition: color 0.15s;
}

.sidebar-devtools-link:hover { color: #64748b; text-decoration: none; }

/* ===== Main Content ===== */
#main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--content-bg);
}

/* ===== Topbar ===== */
#topbar {
    background: var(--topbar-bg);
    border-bottom: 1px solid #dee2e6;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

#sidebar-toggle-btn {
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0.35rem 0.5rem;
    color: #6c757d;
    cursor: pointer;
    line-height: 1;
    display: none;
}

#page-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex: 1;
}

/* ===== Dashboard Sections ===== */
#content-area {
    flex: 1;
    padding: 1.5rem;
    width: 100%;
    min-width: 0;
}

.dash-section { display: block; }

#section-features,
#section-plan {
    max-width: 960px;
}

/* ===== Stat Cards (Overview) ===== */
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    border: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-card-icon {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-icon-green   { background: rgba(4,106,56,0.1);  color: var(--brand-primary); }
.stat-icon-teal    { background: rgba(0,156,166,0.1); color: var(--brand-secondary, #009CA6); }
.stat-icon-orange  { background: rgba(237,139,0,0.1); color: var(--brand-accent); }
.stat-icon-blue    { background: rgba(59,130,246,0.1); color: #3b82f6; }

.stat-card-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6c757d;
    margin-bottom: 0.15rem;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1;
}

/* ===== Brand Buttons ===== */
.btn-brand {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}

.btn-brand:hover, .btn-brand:focus {
    background-color: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);
    color: #fff;
}

.btn-brand:active {
    background-color: var(--brand-primary-dark) !important;
    border-color: var(--brand-primary-dark) !important;
}

.btn-outline-brand {
    color: var(--brand-primary);
    border-color: var(--brand-primary);
    background: transparent;
}

.btn-outline-brand:hover {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}

/* ===== Section Headings ===== */
.section-heading {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6c757d;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

/* ===== Assignment Tabs ===== */
.assignment-tab-label {
    font-size: 0.8rem;
    font-weight: 600;
}

/* ===== Tables ===== */
.admin-table th {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6c757d;
    vertical-align: middle;
    white-space: nowrap;
    border-bottom-width: 1px;
}

.admin-table td {
    vertical-align: middle;
    font-size: 0.875rem;
}

.admin-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.admin-table th.sortable:hover { color: #1e293b; }

.sort-caret { font-size: 0.65rem; margin-left: 0.2rem; }

/* ===== Tier Badges ===== */
.tier-pill {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
}

/* ===== Feature Toggle Cards ===== */
.feature-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 0.75rem;
    transition: opacity 0.2s;
}

.feature-card.feature-locked {
    opacity: 0.45;
    pointer-events: none;
}

.feature-card-body { flex: 1; min-width: 0; }

.feature-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.feature-card-desc {
    font-size: 0.82rem;
    color: #6c757d;
    margin: 0;
}

.lock-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: #F0A500;
    color: #ffffff;
    border: 1px solid #C98B00;
}

/* ===== Plan Cards ===== */
.plan-card {
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s;
}

.plan-card.plan-current {
    border-color: var(--brand-primary);
}

.plan-card-header {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f1f3f5;
}

.plan-name {
    font-size: 1.1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.plan-storage {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 600;
}

.plan-feature-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1.25rem;
    flex: 1;
}

.plan-feature-list li {
    font-size: 0.82rem;
    padding: 0.3rem 0;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.plan-feature-list li i { color: var(--brand-primary); font-size: 0.8rem; }

.plan-feature-list li.locked-feature {
    color: #adb5bd;
    text-decoration: line-through;
}

.plan-feature-list li.locked-feature i { color: #adb5bd; }


/* ===== Toast Container ===== */
#toast-container {
    z-index: 9999;
    min-width: 260px;
}

/* ===== Quick Overview Table ===== */
.overview-table-wrap {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.overview-table-wrap .table { margin: 0; }
.overview-table-wrap .table th { background: #f8f9fa; }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #adb5bd;
}

.empty-state i { font-size: 2.5rem; margin-bottom: 0.75rem; display: block; }
.empty-state p { margin: 0; font-size: 0.9rem; }

/* ===== Mobile ===== */
@media (max-width: 991px) {
    #sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: 240px;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 200;
        box-shadow: 2px 0 12px rgba(0,0,0,0.08);
    }

    #sidebar.sidebar-open { transform: translateX(0); }

    #sidebar-toggle-btn { display: block; }

    #sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.45);
        z-index: 199;
    }

    #sidebar-overlay.active { display: block; }

    #content-area { padding: 1rem; }
}

@media (min-width: 992px) and (max-width: 1199px) {
    #content-area { padding: 1.25rem; }
}

@media (min-width: 1400px) {
    #content-area { padding: 2rem; }
}

@media (max-width: 576px) {
    .stat-card-value { font-size: 1.4rem; }
}

/* ===== Dev Tools Section ===== */
.dt-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
}
.dt-card-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #64748b;
    margin-bottom: 1rem;
}
.dt-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}
.dt-stat-box {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.75rem 1rem;
}
.dt-stat-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    margin-bottom: 0.2rem;
}
.dt-stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e293b;
}
.dt-stat-value.green { color: #16a34a; }
.dt-stat-value.teal  { color: #0891b2; }
.dt-stat-value.amber { color: #d97706; }
.dt-stat-value.gray  { color: #64748b; }

.dt-form-row {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 1rem;
}
.dt-form-row label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
}
.dt-input {
    background: #fff;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    font-size: 0.95rem;
    padding: 0.4rem 0.65rem;
    border-radius: 5px;
    width: 200px;
}
.dt-input:focus { outline: none; border-color: var(--brand-primary); }
.dt-hint {
    font-size: 0.72rem;
    color: #94a3b8;
}

.dt-btn-row {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.dt-btn {
    font-size: 0.78rem;
    padding: 0.4rem 0.85rem;
    border-radius: 5px;
    border: 1px solid;
    cursor: pointer;
    font-weight: 600;
    transition: opacity 0.15s;
}
.dt-btn:hover { opacity: 0.8; }
.dt-btn-save    { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }
.dt-btn-preset  { background: #fff; border-color: #cbd5e1; color: #475569; }
.dt-btn-danger  { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }

.dt-slider-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
}
.dt-slider-row label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
}
.dt-cap-val { color: var(--brand-primary); font-weight: 700; margin-left: 0.4rem; }
.dt-slider-row input[type="range"] { width: 100%; max-width: 380px; accent-color: var(--brand-primary); cursor: pointer; }

/* Submission rows */
.dt-sub-row {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.85rem 1rem;
    margin-bottom: 0.6rem;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
    align-items: start;
}
.dt-sub-title { font-size: 0.85rem; font-weight: 700; color: #1e293b; margin-bottom: 0.4rem; }
.dt-sub-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 3px; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-right: 0.4rem; }
.dt-sub-badge-broll { background: #dbeafe; color: #1d4ed8; }
.dt-sub-badge-story { background: #f3e8ff; color: #7c3aed; }
.dt-sub-controls { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.4rem; }
.dt-sub-controls label { font-size: 0.72rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; }
.dt-sub-controls input[type="number"] { background: #f8fafc; border: 1px solid #cbd5e1; color: #1e293b; font-size: 0.9rem; padding: 0.25rem 0.45rem; border-radius: 4px; width: 60px; }
.dt-sub-threshold { font-size: 0.7rem; color: #94a3b8; margin-top: 0.3rem; }
.dt-sub-threshold input[type="number"] { width: 42px; background: #f8fafc; border: 1px solid #e2e8f0; color: #64748b; font-size: 0.75rem; padding: 0.1rem 0.3rem; border-radius: 3px; }
.dt-tier-badge { display: inline-block; padding: 0.2rem 0.55rem; border-radius: 100px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 0.4rem; }
.dt-tier-participation { background: #dbeafe; color: #1d4ed8; }
.dt-tier-partial        { background: #fef3c7; color: #b45309; }
.dt-tier-bounty         { background: #fefce8; color: #854d0e; border: 1px solid #ca8a04; }
.dt-virality-bonus { font-size: 0.72rem; color: #d97706; margin-left: 0.5rem; }
.dt-btn-boost { background: #fffbeb; border: 1px solid #fbbf24; color: #b45309; font-size: 0.74rem; padding: 0.35rem 0.7rem; border-radius: 4px; cursor: pointer; font-weight: 600; }
.dt-btn-boost:hover { background: #fef3c7; }

.dt-raw {
    background: #1e293b;
    color: #94a3b8;
    border-radius: 6px;
    padding: 1rem;
    font-size: 0.75rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 400px;
    overflow-y: auto;
}

/* ===== Moderation Badges ===== */
.mod-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.45rem;
    border-radius: 100px;
    vertical-align: middle;
    line-height: 1.4;
}
.mod-badge-suspended {
    background: #fff3cd;
    color: #7c5c00;
    border: 1px solid #ffc107;
}
.mod-badge-banned {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* ===== Student Name Clickable ===== */
.student-name-clickable:hover {
    text-decoration: underline;
    opacity: 0.85;
}

/* ===== Student Detail Modal — info blocks ===== */
.sd-info-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
}
.sd-info-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    font-weight: 600;
    margin-bottom: 0.15rem;
}
.sd-info-value {
    font-size: 0.85rem;
    color: #1e293b;
}
.sd-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}

/* ===== Identity Pills (admin detail modal) ===== */
.identity-pill {
    display: inline-block;
    font-size: 0.75rem;
    background: #f0f9ff;
    color: #0369a1;
    border: 1px solid #bae6fd;
    border-radius: 100px;
    padding: 0.2rem 0.6rem;
    font-weight: 600;
}
