/*
 * AuthentiCore custom styles.
 * Prefer AdminLTE / Bootstrap 5. Add rules here only when the theme cannot express them.
 */

:root {
    --ac-ink: #0f172a;
    --ac-slate: #1e293b;
    --ac-mist: #64748b;
    --ac-surface: #f4f6f9;
    --ac-card: #ffffff;
    --ac-accent: #0d9488;
    --ac-accent-deep: #0f766e;
    --ac-glow: rgba(13, 148, 136, 0.18);
    --ac-sidebar: #1e293b;
}

/* Force LIGHT application chrome (never inherit OS/dark mode into content) */
html,
body.layout-fixed {
    color-scheme: light;
    background-color: var(--ac-surface);
}

body.layout-fixed[data-bs-theme="light"],
body.layout-fixed {
    --bs-body-bg: var(--ac-surface);
    --bs-body-color: var(--ac-ink);
}

.app-wrapper {
    background-color: var(--ac-surface);
}

.app-header.bg-white,
.app-header {
    background-color: #fff !important;
    color: var(--ac-ink);
}

.app-header .nav-link {
    color: var(--ac-slate);
}

.app-main {
    background-color: var(--ac-surface);
    color: var(--ac-ink);
}

.app-main .card {
    background-color: var(--ac-card);
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.app-main .card-header {
    background-color: #fff;
    border-bottom: 1px solid #eef2f7;
    padding: 0.65rem 0.9rem;
}

.app-main .card-body {
    padding: 0.9rem;
}

.app-main .card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ac-slate);
}

.app-content-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--ac-slate);
}

.app-footer {
    background: #fff;
    border-top: 1px solid #e5e7eb;
    color: var(--ac-mist);
    font-size: 0.8rem;
}

/* Dark sidebar — richer, less flat */
.app-sidebar.bg-dark {
    background:
        linear-gradient(180deg, rgba(13, 148, 136, 0.14) 0%, transparent 180px),
        linear-gradient(180deg, #0f172a 0%, #1e293b 55%, #0f172a 100%) !important;
    border-right: 1px solid rgba(148, 163, 184, 0.12);
}

.app-sidebar .brand-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.95rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-decoration: none;
    background: rgba(15, 23, 42, 0.35);
}

.app-sidebar .brand-image {
    width: 34px;
    height: 34px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.35);
}

.app-sidebar .brand-text {
    font-weight: 650;
    letter-spacing: -0.02em;
    font-size: 1.05rem;
    color: #f8fafc !important;
    opacity: 1 !important;
}

.app-sidebar .nav-header {
    color: #94a3b8;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.95rem 1rem 0.35rem;
    opacity: 0.95;
}

.app-sidebar .nav-link {
    border-radius: 0.45rem;
    margin: 0.12rem 0.55rem;
    padding: 0.5rem 0.7rem;
    font-size: 0.875rem;
    color: #cbd5e1 !important;
    border-left: 3px solid transparent;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.app-sidebar .nav-link:hover {
    background-color: rgba(148, 163, 184, 0.12) !important;
    color: #f8fafc !important;
}

.app-sidebar .nav-link.active {
    background-color: rgba(13, 148, 136, 0.32) !important;
    color: #fff !important;
    border-left-color: var(--ac-accent);
    box-shadow: inset 0 0 0 1px rgba(13, 148, 136, 0.25);
}

.app-sidebar .nav-icon {
    font-size: 1rem;
    color: #94a3b8;
    margin-right: 0.15rem;
}

.app-sidebar .nav-link:hover .nav-icon,
.app-sidebar .nav-link.active .nav-icon {
    color: #5eead4;
}

/* Compact table action button groups (app-wide) */
.app-main table .btn-group.btn-group-sm,
.app-main .ac-actions {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 0.2rem;
    background: transparent;
    padding: 0;
    border: 0;
    box-shadow: none;
}

.app-main table .btn-group.btn-group-sm > .btn,
.app-main .ac-actions > .btn {
    padding: 0.15rem 0.35rem;
    min-height: 1.55rem;
    min-width: 1.55rem;
    line-height: 1.1;
    font-size: 0.75rem;
    border-radius: 0.3rem !important;
}

.app-main table td:has(.btn-group),
.app-main table th:last-child {
    white-space: nowrap;
    width: 1%;
}

/* Compact, sleek controls inside the app (not auth pages) */
.app-main .form-label {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
    color: #475569;
}

.app-main .form-control,
.app-main .form-select,
.app-main .form-select-sm,
.app-main .form-select-lg,
.app-main .form-control-sm,
.app-main .form-control-lg,
.app-main textarea.form-control {
    min-height: 1.9rem !important;
    height: 1.9rem !important;
    padding: 0.15rem 0.45rem !important;
    font-size: 0.8125rem !important;
    line-height: 1.35 !important;
    border-radius: 0.3rem;
    background-color: #ffffff !important;
    border: 1px solid #64748b !important;
    color: #0f172a;
    box-shadow: none;
}

.app-main textarea.form-control {
    height: auto !important;
    min-height: 4rem !important;
}

.app-main .form-control::placeholder {
    color: #94a3b8;
    font-size: 0.8125rem;
}

.app-main .form-control:focus,
.app-main .form-select:focus {
    border-color: var(--ac-accent) !important;
    box-shadow: 0 0 0 0.15rem var(--ac-glow);
    background-color: #fff !important;
}

.app-main .btn:not(.btn-lg) {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1.35;
    border-radius: 0.3rem;
    min-height: 1.9rem;
}

/* Do NOT shrink Bootstrap switches into square checkboxes */
.app-main .form-check:not(.form-switch) .form-check-input {
    width: 0.95em;
    height: 0.95em;
    margin-top: 0.15em;
}

.app-main .form-switch {
    padding-left: 0;
    min-height: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    padding: 0.2rem 0.65rem 0.2rem 0.35rem;
}

.app-main .form-switch .form-check-input {
    width: 1.75rem;
    height: 1rem;
    margin-left: 0;
    margin-top: 0;
    flex-shrink: 0;
    background-color: #94a3b8;
    border: none;
    cursor: pointer;
    float: none;
}

.app-main .form-switch .form-check-input:focus {
    box-shadow: 0 0 0 0.15rem var(--ac-glow);
}

.app-main .form-switch .form-check-input:checked {
    background-color: var(--ac-accent);
    border-color: var(--ac-accent);
}

.app-main .form-switch .form-check-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #334155;
    margin: 0;
    padding: 0;
    line-height: 1;
    white-space: nowrap;
}

/* Page titles with icon */
.ac-page-title {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 1.1rem;
    font-weight: 650;
    color: #0f172a;
    margin: 0;
}

.ac-page-title i {
    color: var(--ac-accent-deep);
    font-size: 1.15rem;
}

/* License wizard polish */
.ac-wizard .wizard-steps {
    display: flex;
    justify-content: space-between;
    gap: 0.35rem;
    position: relative;
    margin: 0 0 1rem;
    padding: 0.35rem 0 0.75rem;
}

.ac-wizard .wizard-steps::before {
    content: "";
    position: absolute;
    top: 1.05rem;
    left: 8%;
    right: 8%;
    height: 2px;
    background: #e2e8f0;
    z-index: 0;
}

.ac-wizard .wizard-step {
    position: relative;
    z-index: 1;
    flex: 1;
    text-align: center;
}

.ac-wizard .wizard-step-number {
    width: 1.75rem;
    height: 1.75rem;
    margin: 0 auto 0.35rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    background: #e2e8f0;
    color: #64748b;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #cbd5e1;
}

.ac-wizard .wizard-step.active .wizard-step-number {
    background: var(--ac-accent);
    color: #fff;
    box-shadow: 0 0 0 1px var(--ac-accent-deep);
}

.ac-wizard .wizard-step.completed .wizard-step-number {
    background: #0f766e;
    color: #fff;
}

.ac-wizard .wizard-step-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #94a3b8;
    line-height: 1.2;
}

.ac-wizard .wizard-step.active .wizard-step-label {
    color: #0f172a;
}

.ac-wizard .wizard-content h5,
.ac-wizard .wizard-content .ac-step-title {
    font-size: 0.9rem;
    font-weight: 650;
    margin-bottom: 0.75rem;
}

.ac-wizard .wizard-navigation,
.ac-wizard .text-end {
    margin-top: 0.75rem !important;
}

/* Toolbar / filter strip: white card so search stands out from page bg */
.ac-toolbar {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.4rem;
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.85rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.ac-toolbar .form-control,
.ac-toolbar .form-select {
    max-width: 100%;
}

.app-main .input-group-text {
    min-height: 1.9rem;
    padding: 0.15rem 0.45rem;
    font-size: 0.8125rem;
    background-color: #fff;
    border: 1px solid #94a3b8;
    color: #64748b;
}

.app-main .input-group > .form-control,
.app-main .input-group > .form-select {
    height: 1.9rem;
}

.app-main .alert {
    padding: 0.45rem 0.7rem;
    font-size: 0.8rem;
}

.app-main .table {
    font-size: 0.8rem;
}

.app-main .badge {
    font-size: 0.7rem;
    font-weight: 600;
}

/* Dashboard info boxes */
.ac-info-box {
    display: flex;
    align-items: stretch;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.4rem;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    min-height: 74px;
}

.ac-info-box .ac-info-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    flex-shrink: 0;
    color: #fff;
    font-size: 1.35rem;
}

.ac-info-box .ac-info-content {
    padding: 0.55rem 0.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.ac-info-box .ac-info-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
    margin: 0;
}

.ac-info-box .ac-info-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    line-height: 1.2;
}

.ac-info-box.ac-tone-primary .ac-info-icon { background: #2563eb; }
.ac-info-box.ac-tone-success .ac-info-icon { background: #16a34a; }
.ac-info-box.ac-tone-warning .ac-info-icon { background: #d97706; }
.ac-info-box.ac-tone-danger .ac-info-icon { background: #dc2626; }
.ac-info-box.ac-tone-info .ac-info-icon { background: #0891b2; }

/* User dropdown */
.user-menu .user-image {
    width: 28px;
    height: 28px;
    object-fit: cover;
}

.user-menu .dropdown-menu {
    min-width: 220px;
    border-radius: 0.45rem;
}

.user-menu .dropdown-item {
    font-size: 0.875rem;
    padding: 0.4rem 1rem;
}

.user-menu .dropdown-item:active {
    background-color: var(--ac-accent);
}

.user-menu .dropdown-toggle::after {
    margin-left: 0.35rem;
}

/* ---------- Auth pages (login / OTP) ---------- */
.ac-auth-body {
    min-height: 100vh;
    margin: 0;
    font-family: "Segoe UI", system-ui, sans-serif;
    color: var(--ac-ink);
    color-scheme: light;
    background:
        radial-gradient(1200px 600px at 10% 0%, rgba(13, 148, 136, 0.22), transparent 55%),
        radial-gradient(900px 500px at 90% 100%, rgba(15, 23, 42, 0.35), transparent 50%),
        linear-gradient(145deg, #0f172a 0%, #1e293b 48%, #0f766e 140%);
}

.ac-auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.ac-auth-panel {
    width: 100%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 0.5rem;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
    padding: 1.75rem 1.5rem 1.5rem;
}

.ac-auth-brand-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    margin-bottom: 0.35rem;
}

.ac-auth-brand-row img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.ac-auth-brand {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--ac-slate);
    margin: 0;
}

.ac-auth-tagline {
    text-align: center;
    color: var(--ac-mist);
    font-size: 0.85rem;
    margin: 0 0 1.25rem;
}

.ac-activate-panel {
    max-width: 560px;
}

.ac-license-preview {
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 0.4rem;
    background: rgba(248, 250, 252, 0.9);
    padding: 0.75rem 0.85rem;
    margin-top: 0.35rem;
}

.ac-license-preview dl {
    margin-bottom: 0;
}

.ac-license-preview dt {
    font-weight: 500;
}

.ac-license-preview dd {
    margin-bottom: 0.35rem;
}

.ac-auth-panel .form-label {
    font-size: 0.8rem;
    font-weight: 600;
}

.ac-auth-panel .form-control {
    font-size: 0.875rem;
    padding: 0.35rem 0.55rem;
}

.ac-auth-panel .btn {
    padding: 0.35rem 0.65rem;
    font-size: 0.875rem;
}

.ac-auth-panel .form-control:focus {
    border-color: var(--ac-accent);
    box-shadow: 0 0 0 0.2rem var(--ac-glow);
}

.ac-auth-panel .btn-primary {
    background-color: var(--ac-accent);
    border-color: var(--ac-accent);
}

.ac-auth-panel .btn-primary:hover,
.ac-auth-panel .btn-primary:focus {
    background-color: var(--ac-accent-deep);
    border-color: var(--ac-accent-deep);
}

.ac-otp-input {
    font-family: ui-monospace, "Cascadia Mono", "Courier New", monospace;
    font-size: 1.25rem;
    letter-spacing: 0.4rem;
    text-align: center;
}

/* ---------- Shared helpers ---------- */
.ac-section-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ac-required {
    color: var(--bs-danger, #dc3545);
}

.ac-field-hint {
    font-size: 0.75rem;
    color: var(--ac-mist);
}

.ac-pill {
    font-size: 0.72rem;
    font-weight: 600;
}

.ac-stat-card .inner {
    padding: 0.15rem 0;
}

.ac-stat-card h2 {
    font-size: 1.35rem;
    font-weight: 700;
}

.ac-table-actions form {
    display: inline;
}

.ac-table-actions .form-select {
    display: inline-block;
    width: auto;
    min-width: 8.5rem;
}

.ac-narrow-card {
    max-width: 520px;
}

.ac-narrow-card-sm {
    max-width: 420px;
}
