/* ===================================================
   GymFlow — iOS 17 Design System (Global)
   Incluído em todos os header.php
   =================================================== */

:root {
    --t1: #1e293b; --t2: #64748b;
    --bg: #f8fafc; --card: #ffffff; --pill: #f1f5f9;
    --sep: #e2e8f0; --inp: #f8fafc; --sheet: #ffffff; --handle: #cbd5e1;
    --row-hover: rgba(0,0,0,0.03);
    --border: rgba(0,0,0,0.08);
    --shadow-card: 0 4px 20px rgba(0,0,0,0.06);
}
html.dark {
    --t1: #f1f5f9; --t2: #94a3b8;
    --bg: #0f172a; --card: #1e293b; --pill: #334155;
    --sep: #334155; --inp: #1e293b; --sheet: #1e293b; --handle: #475569;
    --row-hover: rgba(255,255,255,0.04);
    --border: rgba(255,255,255,0.08);
    --shadow-card: 0 4px 20px rgba(0,0,0,0.3);
}

/* ---- Base ---- */
body {
    background: var(--bg) !important;
    color: var(--t1) !important;
    font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', 'Inter', sans-serif !important;
    transition: background .3s, color .3s;
}

/* ---- Page wrapper ---- */
.ios-page { background: var(--bg); min-height: 100vh; }

/* ---- Widgets / Cards ---- */
.ios-widget {
    background: var(--card);
    border-radius: 22px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    margin-bottom: 16px;
    transition: background .3s;
}
.ios-widget-sm {
    background: var(--card);
    border-radius: 18px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    transition: background .3s;
}

/* Override glass-card para iOS em todas as páginas */
.glass-card {
    background: var(--card) !important;
    border-color: var(--border) !important;
    backdrop-filter: none !important;
    box-shadow: var(--shadow-card) !important;
    border-radius: 22px !important;
}
html.dark .glass-card {
    background: rgba(30, 41, 59, 0.9) !important;
    border-color: rgba(51, 65, 85, 0.8) !important;
}

/* ---- Buttons ---- */
.ios-btn {
    background: linear-gradient(135deg, #007AFF, #5856D6);
    color: white; border-radius: 14px; font-weight: 700; font-size: 15px;
    box-shadow: 0 4px 16px rgba(0,122,255,0.35); border: none; cursor: pointer;
    transition: all .15s; width: 100%; padding: 16px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-family: inherit;
}
.ios-btn:active { transform: scale(0.97); }
.ios-btn-sm {
    background: linear-gradient(135deg, #007AFF, #5856D6);
    color: white; border-radius: 12px; font-weight: 700; font-size: 13px;
    box-shadow: 0 3px 12px rgba(0,122,255,0.3); border: none; cursor: pointer;
    padding: 10px 18px; display: inline-flex; align-items: center; gap: 6px;
    font-family: inherit; transition: all .15s;
}
.ios-btn-danger {
    background: linear-gradient(135deg, #FF3B30, #FF6B6B);
    color: white; border-radius: 12px; font-weight: 700; font-size: 13px;
    box-shadow: 0 3px 12px rgba(255,59,48,0.3); border: none; cursor: pointer;
    padding: 10px 18px; display: inline-flex; align-items: center; gap: 6px;
    font-family: inherit; transition: all .15s;
}
.ios-btn-ghost {
    background: var(--pill); color: #007AFF; border-radius: 12px;
    font-weight: 600; font-size: 14px; border: none; cursor: pointer;
    padding: 12px 18px; display: inline-flex; align-items: center; gap: 6px;
    font-family: inherit; transition: all .15s;
}

/* ---- Typography ---- */
.ios-label {
    font-size: 11px; font-weight: 600; color: var(--t2);
    letter-spacing: 0.3px; text-transform: uppercase;
}
.ios-title {
    font-size: 28px; font-weight: 800; color: var(--t1);
    letter-spacing: -0.8px; line-height: 1.1;
}
.ios-subtitle { font-size: 13px; color: var(--t2); font-weight: 500; }
.t1 { color: var(--t1) !important; }
.t2 { color: var(--t2) !important; }

/* ---- Badges ---- */
.ios-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700;
}
.ios-badge-green  { background: #d1f5e0; color: #1c7a3e; }
.ios-badge-red    { background: #fde8e8; color: #c0392b; }
.ios-badge-blue   { background: #e0eeff; color: #0055cc; }
.ios-badge-amber  { background: #fff3cd; color: #856404; }
.ios-badge-purple { background: #ede8ff; color: #5b21b6; }
html.dark .ios-badge-green  { background: rgba(52,199,89,0.15);  color: #34C759; }
html.dark .ios-badge-red    { background: rgba(255,59,48,0.15);  color: #FF3B30; }
html.dark .ios-badge-blue   { background: rgba(0,122,255,0.15);  color: #007AFF; }
html.dark .ios-badge-amber  { background: rgba(255,149,0,0.15);  color: #FF9500; }
html.dark .ios-badge-purple { background: rgba(88,86,214,0.15);  color: #5856D6; }

/* ---- List rows ---- */
.ios-sep { height: 1px; background: var(--sep); margin: 0 16px; }
.ios-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; transition: background .15s;
}
.ios-row:hover { background: var(--row-hover); }
.ios-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ---- Inputs ---- */
.ios-input {
    background: var(--inp); border: none; border-radius: 12px;
    padding: 13px 16px; font-size: 15px; color: var(--t1);
    width: 100%; outline: none; font-family: inherit; box-sizing: border-box;
    transition: background .2s;
}
.ios-input:focus { background: var(--pill); }
.ios-select {
    background: var(--inp); border: none; border-radius: 12px;
    padding: 13px 16px; font-size: 15px; color: var(--t1);
    width: 100%; outline: none; font-family: inherit;
    appearance: none; box-sizing: border-box;
}
.ios-textarea {
    background: var(--inp); border: none; border-radius: 12px;
    padding: 13px 16px; font-size: 15px; color: var(--t1);
    width: 100%; outline: none; font-family: inherit;
    box-sizing: border-box; resize: vertical;
}

/* ---- Modals / Sheets ---- */
.ios-modal-bg {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45); backdrop-filter: blur(8px); z-index: 100;
}
.ios-sheet {
    background: var(--sheet); border-radius: 24px 24px 0 0;
    padding: 24px; position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 101; max-height: 90vh; overflow-y: auto; transition: background .3s;
}
.ios-sheet-handle {
    width: 40px; height: 4px; background: var(--handle);
    border-radius: 4px; margin: 0 auto 20px;
}
.ios-modal-card {
    background: var(--card); border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15); transition: background .3s;
}

/* ---- Stat pill ---- */
.stat-pill { background: var(--pill); border-radius: 14px; padding: 14px; text-align: center; }

/* ---- Page header pattern ---- */
.ios-page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.ios-page-title {
    font-size: 32px; font-weight: 800; color: var(--t1);
    letter-spacing: -1px; line-height: 1.1; margin: 0;
}
.ios-page-subtitle { font-size: 13px; color: var(--t2); margin: 4px 0 0; }

/* ---- Table ---- */
.ios-table { width: 100%; border-collapse: collapse; }
.ios-table thead tr {
    border-bottom: 1px solid var(--sep);
}
.ios-table thead th {
    padding: 12px 18px; font-size: 11px; font-weight: 700;
    color: var(--t2); text-transform: uppercase; letter-spacing: 0.3px;
    text-align: left;
}
.ios-table tbody tr {
    border-bottom: 1px solid var(--sep); transition: background .15s;
}
.ios-table tbody tr:last-child { border-bottom: none; }
.ios-table tbody tr:hover { background: var(--row-hover); }
.ios-table tbody td { padding: 14px 18px; font-size: 14px; color: var(--t1); }

/* ---- Search input ---- */
.ios-search {
    background: var(--inp); border: none; border-radius: 12px;
    padding: 11px 16px 11px 40px; font-size: 14px; color: var(--t1);
    outline: none; font-family: inherit; width: 100%; box-sizing: border-box;
}

/* ---- Override pro-input para iOS ---- */
.pro-input {
    background: var(--inp) !important;
    border-color: var(--border) !important;
    color: var(--t1) !important;
    border-radius: 12px !important;
}
.pro-input:focus {
    border-color: #007AFF !important;
    box-shadow: 0 0 0 3px rgba(0,122,255,0.15) !important;
}

/* ---- Override pro-table ---- */
.pro-table thead tr { border-bottom: 1px solid var(--sep) !important; }
.pro-table thead th { color: var(--t2) !important; }
.pro-table tbody tr { border-bottom: 1px solid var(--sep) !important; }
.pro-table tbody tr:hover { background: var(--row-hover) !important; }
.pro-table tbody td { color: var(--t1) !important; }

/* ---- Sidebar override ---- */
html:not(.dark) #sidebar {
    background: #fff !important;
    border-right: 1px solid #e5e7eb !important;
}
html:not(.dark) #sidebar .nav-active { background: rgba(0,122,255,0.1) !important; }
html:not(.dark) #sidebar a { color: #374151 !important; }
html:not(.dark) #sidebar a:hover { background: rgba(0,0,0,0.04) !important; color: #111 !important; }
html:not(.dark) #sidebar .text-white,
html:not(.dark) #sidebar p.text-white { color: #111827 !important; }
html:not(.dark) #sidebar .bg-white\/5 { background: rgba(0,0,0,0.04) !important; }
html:not(.dark) #sidebar .section-title { color: #9ca3af !important; }

/* ---- Body & bg overrides for light mode ---- */
html:not(.dark) body { background: #f2f2f7 !important; color: #1c1c1e !important; }
html:not(.dark) .bg-pro-grid { background-color: #f2f2f7 !important; background-image: none !important; }
html:not(.dark) .text-white { color: #1c1c1e !important; }
html:not(.dark) .text-slate-100 { color: #1c1c1e !important; }
html:not(.dark) .text-slate-200 { color: #374151 !important; }
html:not(.dark) .text-slate-300 { color: #4b5563 !important; }
html:not(.dark) .text-slate-400 { color: #6b7280 !important; }
html:not(.dark) .text-slate-500 { color: #9ca3af !important; }
html:not(.dark) .text-slate-600 { color: #6b7280 !important; }
html:not(.dark) .bg-slate-900\/50, html:not(.dark) .bg-slate-900 { background: #f9fafb !important; }
html:not(.dark) .bg-slate-800\/50, html:not(.dark) .bg-slate-800 { background: #f3f4f6 !important; }
html:not(.dark) .bg-white\/5  { background: rgba(0,0,0,0.04) !important; }
html:not(.dark) .bg-white\/10 { background: rgba(0,0,0,0.07) !important; }
html:not(.dark) .bg-black\/20 { background: rgba(0,0,0,0.04) !important; }
html:not(.dark) .border-white\/5  { border-color: rgba(0,0,0,0.08) !important; }
html:not(.dark) .border-white\/10 { border-color: rgba(0,0,0,0.12) !important; }
html:not(.dark) .border-white\/20 { border-color: rgba(0,0,0,0.16) !important; }
html:not(.dark) .badge-blue   { background: rgba(59,130,246,0.1) !important; }
html:not(.dark) .badge-green  { background: rgba(34,197,94,0.1) !important; }
html:not(.dark) .badge-rose   { background: rgba(244,63,94,0.1) !important; }
html:not(.dark) .badge-amber  { background: rgba(245,158,11,0.1) !important; }
html:not(.dark) .badge-purple { background: rgba(139,92,246,0.1) !important; }
html:not(.dark) .badge-teal   { background: rgba(20,184,166,0.1) !important; }

/* ===== Language Selector ===== */
#lang-dropdown button:first-child { border-radius: 14px 14px 0 0; }
#lang-dropdown button:last-child  { border-radius: 0 0 14px 14px; }

/* ===== RTL Support ===== */
[dir="rtl"] #sidebar { left: auto; right: 0; transform: translateX(100%); }
[dir="rtl"] #sidebar.lg\:translate-x-0 { transform: translateX(0); }
[dir="rtl"] main.lg\:ml-\[272px\] { margin-left: 0 !important; margin-right: 272px !important; }
[dir="rtl"] body.sidebar-collapsed main { margin-right: 88px !important; margin-left: 0 !important; }
[dir="rtl"] .ios-row { flex-direction: row-reverse; }
[dir="rtl"] .ios-page-header { flex-direction: row-reverse; }
[dir="rtl"] .ios-icon { margin-left: 0; margin-right: 0; }
[dir="rtl"] .ios-sep { margin: 0 16px; }
[dir="rtl"] #lang-dropdown { left: 0; right: 0; }

/* ===== Mobile hamburger clearance ===== */
/* Hamburger está agora no canto superior DIREITO (top:16px right:16px).
   O conteúdo das páginas precisa de padding-top mínimo em mobile. */
@media (max-width: 1023px) {
    main.flex-1,
    main[class*="lg:ml-"] {
        padding-top: 20px;
    }
    .ios-page main {
        padding-top: 20px;
    }
}
