/* ================================================
   Hanedan Satranç - Admin Panel (Premium Light)
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700&display=swap');

:root {
    /* Premium light theme */
    --bg-page:       #f1f5f9;
    --bg-card:       #ffffff;
    --bg-sidebar:    #ffffff;
    --bg-input:      #f8fafc;
    --text-primary:  #0f172a;
    --text-secondary:#475569;
    --text-muted:    #64748b;
    --border:        #e2e8f0;
    --border-focus:  #94a3b8;
    --accent:        #0d9488;
    --accent-hover:  #0f766e;
    --accent-light:  rgba(13, 148, 136, 0.08);
    --accent-border: rgba(13, 148, 136, 0.25);
    --danger:        #dc2626;
    --danger-light:  rgba(220, 38, 38, 0.08);
    --success:       #059669;
    --success-light: rgba(5, 150, 105, 0.08);
    --warning:       #d97706;
    --warning-light: rgba(217, 119, 6, 0.08);
    --info:          #0284c7;
    --info-light:    rgba(2, 132, 199, 0.08);
    --shadow-sm:     0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow:       0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg:    0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --radius:        8px;
    --radius-lg:     12px;
    --sidebar-w:     280px;
    --font-title:    'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --transition:    all 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-body);
    font-weight: 400;
    background: var(--bg-page);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- SIDEBAR ---- */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0; top: 0;
    z-index: 200;
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.sidebar-logo {
    padding: 1.5rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.sidebar-logo-icon {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--accent) 0%, #0f766e 100%);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
}
.sidebar-logo-img {
    max-height: 56px;
    width: auto;
    object-fit: contain;
    display: block;
    border-radius: 12px;
}

.sidebar-logo-text { line-height: 1.2; }
.sidebar-logo-name { font-family: var(--font-title); font-size: 1.05rem; color: var(--text-primary); font-weight: 600; display: block; }
.sidebar-logo-sub { font-size: 0.7rem; color: var(--text-muted); letter-spacing: 0.12em; text-transform: uppercase; font-weight: 500; }

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.sidebar-section { padding: 0 1rem 0.35rem; }
.sidebar-section-label {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.85rem 0.5rem 0.4rem;
    display: block;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    margin-bottom: 2px;
}
.sidebar-link:hover { background: var(--accent-light); color: var(--accent); }
.sidebar-link.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
    border-left: 3px solid var(--accent);
    padding-left: calc(1rem - 3px);
}
.sidebar-link .icon { font-size: 1.05rem; width: 22px; text-align: center; opacity: 0.9; }
.sidebar-link .badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 0.7rem; padding: 0.15rem 0.5rem; border-radius: 2rem; font-weight: 600; }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sidebar-user-avatar {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--accent) 0%, #0f766e 100%);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    font-family: var(--font-title);
    color: #fff;
    font-weight: 700;
}
.sidebar-user-info .name { font-size: 0.9rem; color: var(--text-primary); font-weight: 600; display: block; }
.sidebar-user-info .role { font-size: 0.75rem; color: var(--text-muted); }

/* ---- MAIN CONTENT ---- */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---- TOPBAR ---- */
.topbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.topbar-left { display: flex; align-items: center; gap: 1rem; }
.topbar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.35rem;
    cursor: pointer;
    padding: 0.35rem;
    border-radius: var(--radius);
}
.topbar-toggle:hover { background: var(--accent-light); color: var(--accent); }
.page-title { font-family: var(--font-title); font-size: 1.15rem; color: var(--text-primary); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 0.75rem; }
.topbar-btn {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.topbar-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.topbar-btn[style*="danger"] { color: var(--danger); border-color: rgba(220, 38, 38, 0.3); background: var(--danger-light); }
.topbar-btn[style*="danger"]:hover { background: rgba(220, 38, 38, 0.12); color: var(--danger); }

/* ---- CONTENT AREA ---- */
.content { padding: 2rem 2rem; flex: 1; }

/* ---- STAT CARDS ---- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.25rem; margin-bottom: 2rem; }

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}
.stat-card:hover { box-shadow: var(--shadow); border-color: var(--border-focus); transform: translateY(-2px); }
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}
.stat-card.gold::before { background: linear-gradient(90deg, var(--accent), #0f766e); }
.stat-card.blue::before { background: linear-gradient(90deg, var(--info), #0ea5e9); }
.stat-card.green::before { background: linear-gradient(90deg, var(--success), #10b981); }
.stat-card.red::before { background: linear-gradient(90deg, var(--danger), #ef4444); }

.stat-card-icon {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
    display: block;
    opacity: 0.9;
}
.stat-card-num {
    font-family: var(--font-title);
    font-size: 2rem;
    color: var(--text-primary);
    display: block;
    line-height: 1;
    font-weight: 600;
}
.stat-card-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 0.35rem; display: block; font-weight: 500; }
.stat-card-change { font-size: 0.8rem; color: var(--success); margin-top: 0.5rem; display: block; font-weight: 500; }

/* ---- TABLES ---- */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.table-header h3 { font-family: var(--font-title); font-size: 1rem; color: var(--text-primary); font-weight: 600; }

.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
    background: var(--bg-input);
    padding: 0.85rem 1.25rem;
    text-align: left;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
tbody td {
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-primary);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--accent-light); }
tbody td .gray { color: var(--text-muted); font-size: 0.85rem; }

/* ---- BADGES ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 2rem;
    font-size: 0.72rem;
    font-weight: 600;
}
.badge-gold { background: var(--accent-light); color: var(--accent); border: 1px solid var(--accent-border); }
.badge-blue { background: var(--info-light); color: var(--info); border: 1px solid rgba(2, 132, 199, 0.25); }
.badge-green { background: var(--success-light); color: var(--success); border: 1px solid rgba(5, 150, 105, 0.25); }
.badge-red { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(220, 38, 38, 0.25); }
.badge-gray { background: #f1f5f9; color: var(--text-muted); border: 1px solid var(--border); }
.badge-orange { background: var(--warning-light); color: var(--warning); border: 1px solid rgba(217, 119, 6, 0.25); }

/* ---- FORMS ---- */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}
.form-card h3 { font-family: var(--font-title); font-size: 1.05rem; color: var(--text-primary); font-weight: 600; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }

.form-row { display: grid; gap: 1.25rem; }
.form-row.col-2 { grid-template-columns: 1fr 1fr; }
.form-row.col-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; margin-bottom: 0.45rem; font-size: 0.875rem; color: var(--text-secondary); font-weight: 500; }
.form-group label .req { color: var(--danger); }

.form-control {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition);
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control option { background: var(--bg-card); color: var(--text-primary); }
textarea.form-control { resize: vertical; min-height: 120px; }

.form-check { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; }
.form-check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.form-check label { font-size: 0.9rem; color: var(--text-secondary); cursor: pointer; font-weight: 500; }

.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.35rem; }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.65rem 1.35rem;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, var(--accent) 0%, #0f766e 100%); color: #fff; box-shadow: 0 2px 8px rgba(13, 148, 136, 0.35); }
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(13, 148, 136, 0.4); color: #fff; }
.btn-outline { background: var(--bg-card); color: var(--accent); border: 1px solid var(--accent); }
.btn-outline:hover { background: var(--accent-light); color: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(220, 38, 38, 0.3); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-success { background: var(--success-light); color: var(--success); border: 1px solid rgba(5, 150, 105, 0.3); }
.btn-success:hover { background: var(--success); color: #fff; }
.btn-sm { padding: 0.45rem 0.95rem; font-size: 0.82rem; }
.btn-icon { padding: 0.45rem; width: 36px; height: 36px; justify-content: center; border-radius: var(--radius); }

/* ---- ALERTS ---- */
.alert { padding: 1rem 1.25rem; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: 0.9rem; font-weight: 500; }
.alert-success { background: var(--success-light); border: 1px solid rgba(5, 150, 105, 0.25); color: var(--success); }
.alert-danger  { background: var(--danger-light); border: 1px solid rgba(220, 38, 38, 0.25); color: var(--danger); }
.alert-warning { background: var(--warning-light); border: 1px solid rgba(217, 119, 6, 0.25); color: var(--warning); }
.alert-info    { background: var(--info-light); border: 1px solid rgba(2, 132, 199, 0.25); color: var(--info); }

/* ---- LOGIN PAGE ---- */
.login-page {
    margin: 0;
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #f0fdfa 0%, #e0f2fe 50%, #f1f5f9 100%);
}
.login-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 20% 80%, rgba(13, 148, 136, 0.06) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(2, 132, 199, 0.06) 0%, transparent 50%);
    pointer-events: none;
}
.login-box {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo .icon { font-size: 3rem; display: block; margin-bottom: 0.75rem; }
.login-logo h1 { font-family: var(--font-title); font-size: 1.5rem; color: var(--text-primary); font-weight: 600; }
.login-logo p { font-size: 0.88rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ---- SEARCH BAR ---- */
.search-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    min-width: 220px;
}
.search-bar input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    width: 100%;
}
.search-bar input::placeholder { color: var(--text-muted); }

/* ---- PAGINATION ---- */
.pagination { display: flex; justify-content: center; gap: 0.4rem; margin-top: 1.5rem; padding-bottom: 0.5rem; }
.page-btn {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}
.page-btn:hover { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---- ADMIN BREADCRUMB ---- */
.content-toolbar { margin-bottom: 1.25rem; }
.admin-breadcrumb { font-size: 0.85rem; }
.admin-breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; list-style: none; margin: 0; padding: 0; }
.admin-breadcrumb li { display: flex; align-items: center; gap: 0.35rem; color: var(--text-muted); }
.admin-breadcrumb li:not(:last-child)::after { content: '›'; color: var(--text-muted); font-size: 0.9rem; }
.admin-breadcrumb a { color: var(--text-secondary); text-decoration: none; font-weight: 500; }
.admin-breadcrumb a:hover { color: var(--accent); }
.admin-breadcrumb li[aria-current="page"] { color: var(--text-primary); font-weight: 600; }

/* ---- ADMIN EMPTY STATE ---- */
.admin-empty-state {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--bg-input);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
}
.admin-empty-state p { margin: 0; font-size: 0.95rem; }
.admin-empty-state-wrapper { padding: 2rem; }

/* ---- UTILITIES ---- */
.flex { display: flex; align-items: center; gap: 0.75rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.flex-wrap { flex-wrap: wrap; }
.gap-sm { gap: 0.5rem; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-danger { color: var(--danger); } .text-success { color: var(--success); } .text-gold { color: var(--accent); } .text-gray { color: var(--text-muted); }
.small { font-size: 0.82rem; }
.w-100 { width: 100%; }
.d-none { display: none; }

/* ---- MOBILE ---- */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .topbar-toggle { display: block; }
    .form-row.col-2, .form-row.col-3 { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .content { padding: 1.25rem; }
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .table-header { flex-direction: column; align-items: stretch; }
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-input); }
::-webkit-scrollbar-thumb { background: var(--border-focus); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
