/* ═══════════════════════════════════════════════════════════════
   ORIONIX · base.css
   Tokens · Reset · Shared components (buttons, forms, tables,
   modals, toasts, badges, pagination, search, filter-tabs)
   Loaded by ALL pages.
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════
   ORIONIX · aura_v2.css · Unified Light Theme v1
   Covers: index, login, cabinet, admin
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,200;9..40,300;9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

/* ── 1. DESIGN TOKENS ──────────────────────────────────────────────── */
:root {
    --bg:           #f4f4f7;
    --bg-card:      #ffffff;
    --bg-side:      #0d1424;
    --bg-hover:     #f0f2f5;
    --accent:       #1a73e8;
    --accent-dim:   rgba(26, 115, 232, .10);
    --accent-mid:   rgba(26, 115, 232, .25);
    --amber:        #1a73e8;          /* compat alias */
    --amber-dim:    rgba(26,115,232,.45);
    --tx:           #1a1a1a;
    --tx-d:         #666666;
    --tx-m:         #999999;
    --border:       #e0e0e0;
    --green:        #34a853;
    --red:          #ea4335;
    --gold:         #f9ab00;
    --radius:       14px;
    --font:         'DM Sans', 'Segoe UI', Roboto, system-ui, sans-serif;
    --shadow:       0 1px 3px rgba(0,0,0,.07), 0 4px 14px rgba(0,0,0,.05);
    --shadow-lg:    0 8px 40px rgba(0,0,0,.13);
    --header-height: 56px;
    --sidebar-w:    220px;
}

/* ── 2. RESET ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--tx);
    min-height: 100vh;
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d0d0d0; border-radius: 4px; }

/* ── 3. SHARED COMPONENTS ──────────────────────────────────────────── */

/* ·· Buttons ·· */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px; border: none;
    cursor: pointer; font-family: var(--font);
    font-size: 13px; font-weight: 500;
    transition: background .15s, box-shadow .15s, border-color .15s;
    text-decoration: none; line-height: 1.4; white-space: nowrap;
}
.btn-sm  { padding: 5px 12px; font-size: 12px; border-radius: 7px; }
.btn-lg  { padding: 12px 28px; font-size: 15px; border-radius: 10px; }
.btn svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.5; flex-shrink: 0; }

.btn-primary {
    background: var(--accent); color: #fff;
    border: 1px solid var(--accent);
    box-shadow: 0 2px 8px rgba(26,115,232,.28);
}
.btn-primary:hover { background: #1558b0; border-color: #1558b0; box-shadow: 0 4px 14px rgba(26,115,232,.35); }

.btn-secondary {
    background: #fff; color: var(--tx-d);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--tx); }

.btn-danger  { background: var(--red);   color: #fff; border: 1px solid var(--red); }
.btn-danger:hover { background: #c62828; }

/* Icon button */
.btn-icon {
    background: #fff; border: 1px solid var(--border);
    border-radius: 6px; padding: 5px; cursor: pointer;
    color: var(--tx-d); transition: all .15s;
    display: inline-flex; align-items: center;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--tx); }
.btn-icon svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.btn-icon.danger:hover { border-color: rgba(234,67,53,.35); color: var(--red); }

/* Table action buttons */
.btn-action {
    background: var(--accent-dim); border: 1px solid var(--accent-mid);
    border-radius: 6px; padding: 4px 10px; cursor: pointer;
    color: var(--accent); font-size: 11px; font-family: var(--font);
    white-space: nowrap; transition: all .15s;
}
.btn-action:hover    { background: rgba(26,115,232,.18); }
.btn-action.success  { background: rgba(52,168,83,.1);  border-color: rgba(52,168,83,.28);  color: var(--green); }
.btn-action.danger   { background: rgba(234,67,53,.08); border-color: rgba(234,67,53,.25);  color: var(--red); }

/* ·· Forms ·· */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
    font-size: 11px; text-transform: uppercase;
    letter-spacing: .06em; color: var(--tx-d); font-weight: 500;
}
.form-input {
    background: #fff; border: 1px solid var(--border);
    border-radius: 8px; padding: 9px 12px;
    color: var(--tx); font-family: var(--font);
    font-size: 13px; width: 100%; outline: none;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(26,115,232,.1); }
.form-input::placeholder { color: #bbb; }
select.form-input {
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}
.form-hint { font-size: 11px; color: var(--tx-d); margin-top: 3px; }

/* ·· Tables ·· */
.table-wrapper {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    border-radius: 10px; border: 1px solid var(--border);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th {
    font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
    color: var(--tx-d); font-weight: 600; padding: 9px 12px;
    border-bottom: 1px solid var(--border); white-space: nowrap;
    text-align: left; background: #fafafa;
}
.data-table td {
    padding: 11px 12px; border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f0f5ff; }
.table-placeholder { color: var(--tx-d); text-align: center; padding: 32px 12px; font-size: 12px; }
.td-actions { white-space: nowrap; display: flex; gap: 5px; align-items: center; }

/* ·· Pagination ·· */
.pagination-container, .pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 5px; padding: 14px 0 4px; flex-wrap: wrap;
}
.pg-btn, button.pg-btn,
.pagination-btn, button.pagination-btn {
    appearance: none !important; -webkit-appearance: none !important;
    background: #fff !important; border: 1px solid var(--border) !important;
    color: var(--tx-d) !important; border-radius: 6px;
    padding: 5px 10px; cursor: pointer; font-family: var(--font);
    font-size: 12px; min-width: 32px; text-align: center;
    transition: all .15s; box-shadow: none !important;
}
.pg-btn:hover:not(:disabled), .pagination-btn:hover:not(:disabled) {
    background: var(--accent-dim) !important;
    color: var(--accent) !important;
    border-color: var(--accent-mid) !important;
}
.pg-btn.active, button.pg-btn.active,
.pagination-btn.active, button.pagination-btn.active {
    background: var(--accent) !important;
    color: #fff !important;
    border-color: var(--accent) !important;
}
.pg-btn:disabled, .pagination-btn:disabled { opacity: .4; cursor: not-allowed; }
.pg-dots { color: var(--tx-d); font-size: 12px; padding: 0 3px; }

/* Per-page select */
.card-perpage {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 10px; font-size: 11px; color: var(--tx-d);
}
.perpage-select, select.perpage-select {
    appearance: none !important; -webkit-appearance: none !important;
    background: #fff !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 8px center !important;
    background-size: 10px !important;
    border: 1px solid var(--border) !important;
    color: var(--tx) !important; box-shadow: none !important;
    font-family: var(--font); font-size: 11px;
    padding: 3px 26px 3px 7px !important;
    border-radius: 6px; cursor: pointer;
}
select, select option { background: #fff; color: var(--tx); }

/* ·· Modals ·· */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.3); backdrop-filter: blur(4px);
    z-index: 1000; display: none;
    align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
    background: #fff; border: 1px solid var(--border);
    border-radius: 18px; width: 100%; max-width: 480px;
    max-height: 90vh; display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg);
}
.modal.modal-large { max-width: 700px; }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 600; color: var(--tx); }
.modal-close {
    background: none; border: none; color: var(--tx-d);
    cursor: pointer; font-size: 20px; line-height: 1;
    padding: 2px 6px; border-radius: 6px; transition: all .15s;
}
.modal-close:hover { color: var(--tx); background: var(--bg-hover); }
.modal-body {
    padding: 20px 24px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 14px;
}
.modal-footer {
    padding: 16px 24px; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 8px;
}

/* ·· Toast ·· */
.toast-container {
    position: fixed; bottom: 24px; left: 50%;
    transform: translateX(-50%); z-index: 9999; pointer-events: none;
}
.toast {
    background: #fff; border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 10px; padding: 10px 20px;
    font-size: 13px; color: var(--tx); opacity: 0;
    transition: opacity .2s; white-space: nowrap;
    box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; pointer-events: auto; }
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }

/* ·· Loader ·· */
.loader-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(255,255,255,.7); display: none;
    align-items: center; justify-content: center;
}
.loader-overlay.show { display: flex; }
.loader {
    width: 24px; height: 24px;
    border: 2.5px solid #e0e0e0;
    border-top-color: var(--accent);
    border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Cabinet global loader */
#globalLoader {
    position: fixed; inset: 0; z-index: 9999;
    background: var(--bg); display: flex;
    align-items: center; justify-content: center;
}

/* ·· Status badges ·· */
.status-dot {
    display: inline-block; width: 7px; height: 7px;
    border-radius: 50%; margin-right: 5px; flex-shrink: 0;
}
.status-dot.active  { background: var(--green); box-shadow: 0 0 4px rgba(52,168,83,.4); }
.status-dot.blocked { background: var(--red); }
.status-dot.pending { background: var(--gold); }
.status-text.active  { color: var(--green); }
.status-text.blocked { color: var(--red); }
.role-badge {
    font-size: 11px; background: var(--accent-dim);
    border: 1px solid var(--accent-mid);
    border-radius: 6px; padding: 3px 9px;
    color: var(--accent); font-weight: 500;
}

/* ·· Filter tabs ·· */
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-tab {
    background: #fff; border: 1px solid var(--border);
    border-radius: 7px; padding: 5px 12px; color: var(--tx-d);
    font-family: var(--font); font-size: 11px; font-weight: 500;
    cursor: pointer; transition: all .15s; white-space: nowrap;
}
.filter-tab:hover { background: var(--bg-hover); color: var(--tx); }
.filter-tab.active {
    background: var(--accent-dim); color: var(--accent);
    border-color: var(--accent-mid);
}

/* ·· Search ·· */
.search-input {
    background: #fff; border: 1px solid var(--border);
    border-radius: 8px; padding: 7px 12px;
    color: var(--tx); font-family: var(--font);
    font-size: 12px; outline: none;
    transition: border-color .15s, box-shadow .15s; min-width: 200px;
}
.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(26,115,232,.08);
}
.search-input::placeholder { color: #bbb; }
.search-wrapper { position: relative; }

/* ·· Layout toggle (admin dashboard + cabinet) ·· */
.layout-toggle {
    display: flex; gap: 5px;
    background: none; border: none; padding: 0;
}
.layout-btn {
    padding: 5px 11px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--tx-d);
    font-family: var(--font); font-size: 11px; font-weight: 500;
    cursor: pointer; display: flex; align-items: center; gap: 5px;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}
.layout-btn:hover { background: var(--bg-hover); color: var(--tx); }
.layout-btn.active {
    background: var(--bg-side);
    border-color: var(--bg-side);
    color: #fff;
}
.layout-btn.active:hover { background: #1a2540; border-color: #1a2540; }
.layout-btn svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.5; flex-shrink: 0; }