/* ===== TEMA: VARIÁVEIS ===== */
:root, [data-theme="light"] {
    --bg:          #f0f2f5;
    --surface:     #ffffff;
    --surface-2:   #f8f9fa;
    --border:      #e8eaed;
    --border-sub:  #f0f0f0;
    --text:        #1a1a2e;
    --text-muted:  #555555;
    --text-faint:  #999999;
    --input-bd:    #dde2e8;
    --shadow:      rgba(0,0,0,.08);
    --topbar-bg:   #ffffff;
}

[data-theme="dark"] {
    --bg:          #0f172a;
    --surface:     #1e293b;
    --surface-2:   #253347;
    --border:      #334155;
    --border-sub:  #2d3f55;
    --text:        #e2e8f0;
    --text-muted:  #94a3b8;
    --text-faint:  #64748b;
    --input-bd:    #475569;
    --shadow:      rgba(0,0,0,.35);
    --topbar-bg:   #1e293b;
}

/* ===== LAYOUT ===== */
*, *::before, *::after { box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); margin: 0; color: var(--text); transition: background .2s, color .2s; }

.app-wrapper { display: flex; min-height: 100vh; }
.main-area   { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.page-content { flex: 1; padding: 1.5rem; max-width: 1400px; width: 100%; }

/* ===== SIDEBAR ===== */
.sidebar {
    width: 240px; min-height: 100vh;
    background: var(--primary, #1a237e);
    color: #fff; flex-shrink: 0;
    display: flex; flex-direction: column;
    transition: transform .25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: .75rem;
    padding: 1.25rem 1rem; border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo      { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; }
.sidebar-logo-placeholder { width: 40px; height: 40px; background: rgba(255,255,255,.15); border-radius: 8px; display:flex; align-items:center; justify-content:center; font-size:1.25rem; }
.sidebar-name      { font-size: .85rem; font-weight: 600; line-height: 1.2; }

.sidebar-menu      { list-style: none; margin: 0; padding: .5rem 0; overflow-y: auto; flex: 1; }
.sidebar-menu li a {
    display: flex; align-items: center; gap: .75rem;
    padding: .6rem 1rem; color: rgba(255,255,255,.8);
    text-decoration: none; font-size: .875rem; border-radius: 0;
    transition: background .15s, color .15s;
}
.sidebar-menu li a:hover, .sidebar-menu li a.active {
    background: rgba(255,255,255,.15); color: #fff;
}
.sidebar-menu li a i { width: 18px; text-align: center; font-size: .9rem; }
.menu-section { font-size: .65rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.4); padding: 1rem 1rem .25rem; }

/* ===== TOPBAR ===== */
.topbar {
    display: flex; align-items: center; gap: 1rem;
    padding: .75rem 1.5rem; background: var(--topbar-bg);
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100;
    transition: background .2s, border-color .2s;
}
.topbar-title  { flex: 1; font-size: 1.1rem; font-weight: 600; color: var(--text); margin: 0; }
.topbar-user   { display: flex; align-items: center; gap: .75rem; font-size: .875rem; color: var(--text-muted); }
.user-avatar   { width: 36px; height: 36px; border-radius: 50%; background: var(--primary, #1a237e); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .875rem; }
.sidebar-toggle { background: none; border: none; font-size: 1.25rem; cursor: pointer; color: var(--text-muted); padding: .25rem; display: none; }

/* Botão de tema */
.theme-toggle {
    background: none; border: 1px solid var(--border); border-radius: 8px;
    width: 34px; height: 34px; cursor: pointer; font-size: .95rem;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); transition: all .2s;
    flex-shrink: 0;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--text); }

/* ===== PAGE HEADER ===== */
.page-header { display: flex; justify-content: flex-end; margin-bottom: 1rem; }

/* ===== CARDS ===== */
.card { border: 1px solid var(--border-sub) !important; border-radius: 12px; box-shadow: 0 1px 4px var(--shadow); background: var(--surface) !important; }
.card-header { background: var(--surface) !important; border-bottom: 1px solid var(--border-sub) !important; font-weight: 600; padding: .875rem 1.25rem; border-radius: 12px 12px 0 0 !important; color: var(--text); }
.card-body { color: var(--text); }
.card-footer { background: var(--surface) !important; border-top: 1px solid var(--border-sub) !important; }

/* ===== STAT CARDS ===== */
.stat-card {
    border-radius: 12px; padding: 1.25rem;
    display: flex; flex-direction: column; gap: .5rem;
    color: #fff; position: relative; overflow: hidden;
}
.stat-blue   { background: linear-gradient(135deg, #1a237e, #283593); }
.stat-green  { background: linear-gradient(135deg, #1b5e20, #2e7d32); }
.stat-orange { background: linear-gradient(135deg, #e65100, #f57c00); }
.stat-red    { background: linear-gradient(135deg, #b71c1c, #c62828); }

.stat-icon  { font-size: 1.75rem; opacity: .6; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .8rem; opacity: .85; }

/* ===== TABLES ===== */
.table { font-size: .875rem; color: var(--text); }
.table thead th { background: var(--surface-2); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); border-bottom: 1px solid var(--border) !important; }
.table tbody tr { border-color: var(--border-sub); }
.table-hover tbody tr:hover { background: var(--surface-2) !important; }
[data-theme="dark"] .table { --bs-table-striped-bg: rgba(255,255,255,.03); }
[data-theme="dark"] .table-light { --bs-table-bg: var(--surface-2); color: var(--text); }

/* ===== AVATAR ===== */
.table-avatar, .athlete-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--primary, #1a237e); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .85rem; overflow: hidden; flex-shrink: 0;
}
.table-avatar img, .athlete-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ===== ATHLETE LISTS ===== */
.athlete-list, .training-list { list-style: none; margin: 0; padding: 0; }
.athlete-list-item, .training-list-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .75rem 1.25rem; border-bottom: 1px solid var(--border-sub);
    color: var(--text);
}
.athlete-list-item:last-child, .training-list-item:last-child { border-bottom: none; }
.athlete-info { flex: 1; display: flex; flex-direction: column; }
.athlete-info strong { font-size: .875rem; }
.training-date { text-align: center; min-width: 44px; }
.t-day { display: block; font-size: 1.3rem; font-weight: 700; line-height: 1; color: var(--primary); }
.t-mon { display: block; font-size: .65rem; text-transform: uppercase; color: var(--text-faint); }
.training-info { flex: 1; display: flex; flex-direction: column; }

/* ===== FINANCIAL SUMMARY ===== */
.financial-summary { display: flex; flex-direction: column; gap: .75rem; }
.fs-item { display: flex; justify-content: space-between; align-items: center; }
.fs-label { color: var(--text-muted); font-size: .875rem; }
.fs-value { font-weight: 600; color: var(--text); }

/* ===== PHOTOS ===== */
.athlete-photo-preview  { width: 120px; height: 120px; object-fit: cover; border-radius: 12px; }
.athlete-photo-large    { width: 160px; height: 160px; object-fit: cover; border-radius: 16px; }
.athlete-photo-placeholder, .athlete-photo-placeholder-lg { display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-radius: 12px; width: 120px; height: 120px; margin: 0 auto; color: var(--text-muted); }
.athlete-photo-placeholder-lg { width: 160px; height: 160px; }
.school-logo-preview { max-width: 120px; max-height: 80px; object-fit: contain; }

/* ===== FORMS ===== */
.form-label { font-size: .8rem; font-weight: 600; color: var(--text-muted); margin-bottom: .35rem; }
.form-control, .form-select { font-size: .875rem; border-radius: 8px; border-color: var(--input-bd); background: var(--surface); color: var(--text); }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,35,126,.15); background: var(--surface); color: var(--text); }
.form-control::placeholder { color: var(--text-faint); }
.form-text { color: var(--text-muted); }
[data-theme="dark"] .form-control[readonly] { background: var(--surface-2); color: var(--text-muted); }

/* ===== BUTTONS ===== */
.btn { border-radius: 8px; font-size: .875rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-outline-secondary { border-color: var(--border); color: var(--text-muted); }
.btn-outline-secondary:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }

/* ===== ALERTS / BADGES ===== */
[data-theme="dark"] .bg-light { background: var(--surface-2) !important; }
[data-theme="dark"] .text-dark { color: var(--text) !important; }
[data-theme="dark"] .border { border-color: var(--border) !important; }
[data-theme="dark"] .text-muted { color: var(--text-muted) !important; }
[data-theme="dark"] .bg-white { background: var(--surface) !important; }
[data-theme="dark"] .alert-light { background: var(--surface-2); border-color: var(--border); color: var(--text-muted); }
[data-theme="dark"] .alert-info  { background: rgba(13,202,240,.1); color: #7ee8f8; border-color: rgba(13,202,240,.2); }

/* Modal dark */
[data-theme="dark"] .modal-content { background: var(--surface); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .modal-header  { border-color: var(--border); }
[data-theme="dark"] .modal-footer  { border-color: var(--border); }

/* Input group dark */
[data-theme="dark"] .input-group-text { background: var(--surface-2); border-color: var(--input-bd); color: var(--text-muted); }

/* ===== LOGIN ===== */
.login-body    { background: linear-gradient(135deg, #1a237e 0%, #0d47a1 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-wrapper { width: 100%; max-width: 420px; padding: 1rem; }
.login-card    { background: #fff; border-radius: 20px; padding: 2.5rem; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-logo    { text-align: center; color: var(--primary, #1a237e); margin-bottom: 1rem; }
.login-title   { text-align: center; font-size: 1.5rem; font-weight: 700; color: #1a1a2e; margin-bottom: .25rem; }
.login-subtitle { text-align: center; color: #888; margin-bottom: 1.5rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 1000; transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: block; }
    .page-content { padding: 1rem; }
}

/* ===== MISC ===== */
.cursor-pointer { cursor: pointer; }
.form-check-input[role=switch] { width: 2.5em; height: 1.3em; cursor: pointer; }
hr { border-color: var(--border-sub); }

/* ===== DARK: scrollbar sutil ===== */
[data-theme="dark"] ::-webkit-scrollbar { width: 6px; height: 6px; }
[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--bg); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
