/* =========================================================
   THEME UNIFY (LOAD LAST)
   Purpose: force a single visual language across all pages,
   even if legacy page CSS still defines button/card variants.
   ========================================================= */

:root {
    --theme-accent: #0ea5e9;
    --theme-accent-strong: #2563eb;
    --theme-text-dark: #0f172a;
    --theme-text-muted: #64748b;
    --theme-surface: #ffffff;
    --theme-surface-soft: #f8fafc;
    --theme-border: rgba(148, 163, 184, 0.32);
}

/* -------------------------
   BUTTON SYSTEM (AUTHORITATIVE)
-------------------------- */
.btn {
    border-radius: 10px;
    border: 1px solid transparent;
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: none;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background-color .15s ease, color .15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.18);
}

.btn-primary {
    background: linear-gradient(135deg, var(--theme-accent-strong), var(--theme-accent));
    border-color: rgba(56, 189, 248, 0.6);
    color: #ffffff;
}

.btn-create,
.btn-add {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    border-color: rgba(134, 239, 172, 0.68);
    color: #ffffff;
}

.btn-create:hover,
.btn-add:hover {
    background: linear-gradient(135deg, #15803d, #16a34a);
    box-shadow: 0 8px 16px rgba(22, 163, 74, 0.28);
}

.btn-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 46px;
    padding: 0 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.01em;
    background: linear-gradient(135deg, var(--theme-accent-strong), var(--theme-accent));
    border-color: rgba(56, 189, 248, 0.62);
    color: #ffffff;
}

.btn-login:hover {
    background: linear-gradient(135deg, #1d4ed8, #0284c7);
    box-shadow: 0 8px 18px rgba(14, 116, 144, 0.28);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8, #0284c7);
    box-shadow: 0 8px 18px rgba(14, 116, 144, 0.28);
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b, #475569);
    border-color: rgba(148, 163, 184, 0.72);
    color: #ffffff;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #475569, #334155);
    box-shadow: 0 8px 16px rgba(51, 65, 85, 0.25);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #be123c);
    border-color: rgba(248, 113, 113, 0.65);
    color: #ffffff;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c, #9f1239);
    box-shadow: 0 8px 16px rgba(190, 24, 93, 0.28);
}

.btn-outline,
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-success,
.btn-outline-danger,
.btn-delete,
.btn-remove {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(2px);
}

.btn-outline,
.btn-outline-primary {
    color: var(--theme-accent-strong);
    border-color: rgba(37, 99, 235, 0.55);
}

.btn-outline:hover,
.btn-outline-primary:hover {
    background: linear-gradient(135deg, var(--theme-accent-strong), var(--theme-accent));
    color: #ffffff;
    border-color: rgba(125, 211, 252, 0.7);
}

.btn-outline-secondary {
    color: #475569;
    border-color: rgba(100, 116, 139, 0.6);
}

.btn-outline-secondary:hover {
    background: linear-gradient(135deg, #64748b, #475569);
    border-color: rgba(148, 163, 184, 0.8);
    color: #ffffff;
}

.btn-outline-success {
    color: #16a34a;
    border-color: rgba(34, 197, 94, 0.66);
}

.btn-outline-success:hover {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    border-color: rgba(134, 239, 172, 0.75);
    color: #ffffff;
}

.btn-outline-danger,
.btn-delete,
.btn-remove {
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.65);
}

.btn-outline-danger:hover,
.btn-delete:hover,
.btn-remove:hover {
    background: linear-gradient(135deg, #dc2626, #be123c);
    border-color: rgba(248, 113, 113, 0.8);
    color: #ffffff;
}

/* -------------------------
   CARD SYSTEM NORMALIZATION
-------------------------- */
.page-card,
.form-card,
.card,
.tab-panel {
    border-radius: 14px;
    border: 1px solid var(--theme-border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(248, 250, 252, 0.95) 100%);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
}

.page-card:hover,
.form-card:hover,
.card:hover,
.tab-panel:hover {
    border-color: rgba(14, 165, 233, 0.34);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.1);
}

/* -------------------------
   FILTER + ACTION BAR
-------------------------- */
.filter-bar,
.filter-row,
.log-filter-grid {
    border-radius: 12px;
}

.page-actions,
.form-actions,
.action-buttons,
.table-actions {
    gap: 8px;
}

/* -------------------------
   TABS (UNIFIED)
-------------------------- */
.form-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: linear-gradient(180deg, rgba(241, 245, 249, 0.9) 0%, rgba(248, 250, 252, 0.92) 100%);
}

.form-tab {
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 9px;
    border: 1px solid transparent;
    color: #475569;
    background: rgba(255, 255, 255, 0.75);
    transition: transform .15s, box-shadow .15s, color .15s, border-color .15s, background-color .15s;
}

.form-tab:hover {
    color: #0f172a;
    border-color: rgba(14, 165, 233, 0.4);
    background: rgba(255, 255, 255, 0.98);
    transform: translateY(-1px);
}

.form-tab.active {
    color: #ffffff;
    border-color: rgba(56, 189, 248, 0.65);
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    box-shadow: 0 8px 16px rgba(14, 116, 144, 0.24);
    transform: translateY(-1px);
}

.tab-panel {
    display: none;
    padding: 14px 16px;
}

.tab-panel.active {
    display: block;
}

/* -------------------------
   FORM CONTROLS SAFETY OVERRIDE
-------------------------- */
.form-control,
.form-select,
textarea {
    border-color: var(--theme-border);
    background: linear-gradient(180deg, var(--theme-surface) 0%, var(--theme-surface-soft) 100%);
    color: var(--theme-text-dark);
}

.form-control:focus,
.form-select:focus,
textarea:focus {
    border-color: rgba(14, 165, 233, 0.85);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.18), 0 8px 18px rgba(15, 23, 42, 0.08);
}

/* -------------------------
   TABLE SURFACES
-------------------------- */
.table-wrapper {
    border-radius: 14px;
    border: 1px solid var(--theme-border);
}

.table-custom thead th {
    color: #334155;
}

.table-custom tbody td {
    color: var(--theme-text-dark);
}

th.col-info,
td.col-info {
    width: 64px;
    min-width: 64px;
    text-align: center;
    white-space: nowrap;
}

th.col-actions,
td.col-actions {
    text-align: left;
    white-space: nowrap;
}

.table-custom tbody td.col-actions,
td.col-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

td.col-info,
td.col-actions {
    overflow: visible;
    text-overflow: clip;
}

.table-custom tbody td.col-actions .action-buttons,
td.col-actions .action-buttons,
td.col-actions .table-actions {
    width: 100%;
    justify-content: flex-start;
}

.btn-audit-info {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(148, 163, 184, 0.55);
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    font-size: 0;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease, color .15s ease;
}

.btn-audit-info::before {
    content: "i";
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

.btn-audit-info:hover {
    color: #0284c7;
    border-color: rgba(14, 165, 233, 0.7);
    box-shadow: 0 6px 14px rgba(14, 165, 233, 0.22);
    transform: translateY(-1px);
}

.btn-audit-info:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.24);
}

/* -------------------------
   LOGIN / AUTH PAGES
-------------------------- */
.auth-body {
    background:
        radial-gradient(140% 80% at 0% 0%, rgba(56, 189, 248, 0.18) 0%, transparent 42%),
        radial-gradient(120% 70% at 100% 100%, rgba(37, 99, 235, 0.16) 0%, transparent 44%),
        linear-gradient(180deg, #0f172a 0%, #111827 100%);
}

.auth-card,
.login-card {
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.95) 100%);
    box-shadow: 0 22px 44px rgba(2, 6, 23, 0.34);
}

.login-form input,
.auth-card input,
.form-input {
    border: 1px solid rgba(148, 163, 184, 0.36);
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    color: #0f172a;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.login-form input:focus,
.auth-card input:focus,
.form-input:focus {
    outline: none;
    transform: translateY(-1px);
    border-color: rgba(14, 165, 233, 0.88);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.18), 0 8px 18px rgba(15, 23, 42, 0.08);
}

/* -------------------------
   DETAIL PAGES
-------------------------- */
.readonly-value,
.detail-value,
.log-detail-value {
    min-height: 40px;
    padding: 9px 12px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    color: #0f172a;
}

.detail-header,
.detail-meta,
.detail-actions,
.log-detail-card {
    border-radius: 12px;
}

.detail-header,
.detail-actions,
.detail-meta {
    padding: 12px 14px;
}

.detail-meta,
.log-detail-card {
    border: 1px solid rgba(148, 163, 184, 0.26);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.94) 100%);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.profile-grid {
    gap: 16px;
}

.profile-value,
.readonly-value {
    padding: 10px 12px;
    min-height: 42px;
    border-radius: 10px;
}

.language-form {
    display: flex;
    justify-content: center;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px dashed rgba(148, 163, 184, 0.35);
}

.login-language-toggle {
    display: inline-flex;
    gap: 8px;
    padding: 6px;
    border-radius: 999px;
    background: rgba(241, 245, 249, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.lang-btn {
    width: 42px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: #ffffff;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease, background-color 0.2s ease, color 0.2s ease;
}

.lang-btn:hover {
    border-color: rgba(14, 165, 233, 0.75);
    background: rgba(239, 246, 255, 0.95);
}

.lang-btn.active {
    border-color: rgba(37, 99, 235, 0.75);
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    color: #ffffff;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.22);
}

.lang-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #2563eb;
}

.login-secondary {
    color: #0284c7;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.login-secondary:hover {
    color: #0369a1;
    text-decoration: underline;
}

/* -------------------------
   IMPORT PREVIEW / EXCEL UPLOAD
-------------------------- */
.import-summary {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px;
    margin-bottom: 12px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(241, 245, 249, 0.84) 100%);
}

.row-valid {
    background: rgba(22, 163, 74, 0.08);
}

.row-error {
    background: rgba(220, 38, 38, 0.08);
}

.import-progress-wrapper {
    margin-top: 10px;
    margin-bottom: 10px;
}

.import-progress-wrapper .progress {
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(148, 163, 184, 0.25);
}

.import-progress-wrapper .progress-bar {
    background: linear-gradient(90deg, #2563eb, #0ea5e9);
}

/* -------------------------
   MOBILE
-------------------------- */
@media (max-width: 768px) {
    .btn {
        min-height: 36px;
    }

    .page-actions,
    .form-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .import-summary {
        padding: 8px;
    }
}
