/*
 * URC Design System — Component Classes
 *
 * Source of truth for all component CSS. Pre-expanded from Tailwind @apply
 * directives so this file works as a standard <link> stylesheet.
 *
 * CSS variable references (hsl(var(--primary)), etc.) resolve against the
 * :root block that stays inline in base.html / base_auth.html.
 *
 * Tailwind JIT still processes utility classes in HTML class="" attributes.
 */

/* ── Button variants ────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    border-radius: 9999px;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
    height: 2.5rem;
    padding: 0.5rem 1rem;
}
.btn:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}
.btn:active {
    transform: scale(0.98);
}
.btn:disabled {
    pointer-events: none;
    opacity: 0.5;
}

.btn-primary {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}
.btn-primary:hover {
    background-color: hsl(var(--primary) / 0.9);
}

.btn-secondary {
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}
.btn-secondary:hover {
    background-color: hsl(var(--secondary) / 0.8);
}

.btn-destructive {
    background-color: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
}
.btn-destructive:hover {
    background-color: hsl(var(--destructive) / 0.9);
}

.btn-danger {
    background-color: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
}
.btn-danger:hover {
    background-color: hsl(var(--destructive) / 0.9);
}

.btn-outline {
    border: 1px solid hsl(var(--input));
    background-color: hsl(var(--background));
}
.btn-outline:hover {
    background-color: hsl(var(--muted));
    color: hsl(var(--foreground));
}

.btn-ghost {}
.btn-ghost:hover {
    background-color: hsl(var(--muted));
    color: hsl(var(--foreground));
}

.btn-accent {
    background: var(--urc-gradient-accent);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}
.btn-accent:hover {
    opacity: 0.9;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.btn-link {
    color: hsl(var(--accent));
    text-underline-offset: 4px;
    height: auto;
    padding: 0;
}
.btn-link:hover {
    text-decoration: underline;
}

.btn-sm {
    height: 2.25rem;
    border-radius: 9999px;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    font-size: 0.75rem;
    line-height: 1rem;
}

.btn-lg {
    height: 2.75rem;
    border-radius: 9999px;
    padding-left: 2rem;
    padding-right: 2rem;
}

.btn-icon {
    height: 2.5rem;
    width: 2.5rem;
    padding: 0;
}

.btn-icon-sm {
    height: 1.75rem;
    width: 1.75rem;
    padding: 0;
}

.btn-primary:hover, .btn-outline:hover, .btn-secondary:hover, .btn-ghost:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.btn-primary:active, .btn-outline:active, .btn-secondary:active, .btn-ghost:active {
    transform: translateY(0);
    box-shadow: none;
}


/* ── Card ───────────────────────────────────── */
.card {
    border-radius: 0.75rem;
    border: 1px solid hsl(var(--border));
    background-color: hsl(var(--card));
    color: hsl(var(--card-foreground));
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.card-interactive {
    cursor: pointer;
    text-decoration: none;
    color: hsl(var(--card-foreground));
    transition: transform var(--transition-base) ease, box-shadow var(--transition-base) ease, border-color var(--transition-base) ease;
}
.card-interactive:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    border-color: hsl(var(--primary) / 0.3);
}
.card-interactive:active {
    transform: translateY(0);
}
.card-interactive .card-title,
.card-interactive .font-semibold {
    transition: color var(--transition-fast) ease;
}
.card-interactive:hover .card-title,
.card-interactive:hover .font-semibold {
    color: hsl(var(--primary));
}

.card-header {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding: 1.5rem;
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
}

.card-title {
    font-size: 1.125rem;
    line-height: 1.75rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.025em;
}

.card-description {
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: hsl(var(--muted-foreground));
}

.card-content {
    padding: 1.5rem;
    padding-top: 0;
}

.card-footer {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    padding-top: 0;
}

.card-section {
    padding: 1.5rem;
    border-top: 1px solid hsl(var(--border));
}
.card-section:first-child {
    border-top: 0;
}


/* ── Input / Label / Select / Textarea ──────── */
.input {
    display: flex;
    height: 2.5rem;
    width: 100%;
    border-radius: 0.5rem;
    border: 1px solid hsl(var(--input));
    background-color: hsl(var(--background));
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
}
.input::placeholder {
    color: hsl(var(--muted-foreground));
}
.input:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}
.input:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}
.input::file-selector-button {
    border: 0;
    background-color: transparent;
    font-size: 0.875rem;
    font-weight: 500;
}

select.input {
    padding-right: 2.5rem;
}

.label {
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    line-height: 1;
}
.label-required::after {
    content: " *";
    color: hsl(var(--destructive));
}

.input-sm {
    height: 2rem;
    font-size: 0.75rem;
    line-height: 1rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.input-error {
    border-color: hsl(var(--destructive));
}
.input-error:focus-visible {
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--destructive));
}

.input-success {
    border-color: hsl(var(--success));
}
.input-success:focus-visible {
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--success));
}

.textarea {
    display: flex;
    width: 100%;
    border-radius: 0.5rem;
    border: 1px solid hsl(var(--input));
    background-color: hsl(var(--background));
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    min-height: 80px;
    height: auto;
}
.textarea::placeholder {
    color: hsl(var(--muted-foreground));
}
.textarea:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}
.textarea:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.select {
    display: flex;
    height: 2.5rem;
    width: 100%;
    border-radius: 0.5rem;
    border: 1px solid hsl(var(--input));
    background-color: hsl(var(--background));
    padding: 0.5rem 0.75rem;
    padding-right: 2.5rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236e7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.625rem center;
    background-size: 1rem;
}
.select:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}
.select:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230D4F4F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.select:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}


/* ── Typography scale (fluid) ───────────────── */
.text-xs   { font-size: var(--fs-xs) !important; }
.text-sm   { font-size: var(--fs-sm) !important; }
.text-base { font-size: var(--fs-base) !important; }
.text-lg   { font-size: var(--fs-lg) !important; }
.text-xl   { font-size: var(--fs-xl) !important; }
.text-2xl  { font-size: var(--fs-2xl) !important; }
.text-3xl  { font-size: var(--fs-3xl) !important; }
.text-4xl  { font-size: var(--fs-4xl) !important; }

.text-page-title {
    font-size: var(--fs-2xl);
    font-weight: 700;
    letter-spacing: -0.025em;
}
.text-section-title {
    font-size: var(--fs-lg);
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.025em;
}
.text-body {
    font-size: var(--fs-sm);
    color: hsl(var(--foreground));
}
.text-body-muted {
    font-size: var(--fs-sm);
    color: hsl(var(--muted-foreground));
}
.text-caption {
    font-size: var(--fs-xs);
    color: hsl(var(--muted-foreground));
}


/* ── Badge ──────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    border: 1px solid transparent;
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    line-height: 1rem;
    font-weight: 600;
    transition: color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
.badge:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}

.badge-default {
    border-color: transparent;
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}
.badge-secondary {
    border-color: transparent;
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}
.badge-destructive {
    border-color: transparent;
    background-color: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
}
.badge-outline {
    color: hsl(var(--foreground));
}
.badge-accent {
    border-color: transparent;
    background-color: hsl(var(--success) / 0.1);
    color: hsl(var(--success));
}
.badge-success {
    border-color: transparent;
    background-color: hsl(var(--success) / 0.1);
    color: hsl(var(--success));
}
.badge-warning {
    border-color: transparent;
    background-color: hsl(var(--warning) / 0.1);
    color: hsl(var(--warning));
}
.badge-info {
    border-color: transparent;
    background-color: hsl(var(--info) / 0.1);
    color: hsl(var(--info));
}

.icon-destructive {
    color: hsl(0 84.2% 60.2%);
}
.icon-destructive:hover {
    color: hsl(0 84.2% 45%);
}


/* ── Table ──────────────────────────────────── */
.table-wrapper {
    width: 100%;
    overflow: auto;
    border-radius: 0.75rem;
}

table.data-table {
    width: 100%;
    caption-side: bottom;
    font-size: 0.875rem;
    line-height: 1.25rem;
}
table.data-table thead tr {
    border-bottom: 1px solid hsl(var(--border));
}
table.data-table thead th {
    height: 3rem;
    padding-left: 1rem;
    padding-right: 1rem;
    text-align: left;
    vertical-align: middle;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
}
table.data-table tbody tr {
    border-bottom: 1px solid hsl(var(--border));
    transition: color 150ms cubic-bezier(0.4, 0, 0.2, 1), background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
table.data-table tbody tr:hover {
    background-color: hsl(var(--muted) / 0.5);
}
table.data-table tbody td {
    padding: 1rem;
    vertical-align: middle;
}

table.data-table-compact thead th {
    height: 2.5rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    font-size: 0.75rem;
    line-height: 1rem;
}
table.data-table-compact tbody td {
    padding: 0.75rem;
    font-size: 0.75rem;
    line-height: 1rem;
}

table.data-table tbody tr.table-row-clickable {
    cursor: pointer;
}
table.data-table tbody tr.table-row-clickable:hover {
    background-color: hsl(var(--muted) / 0.7);
}


/* ── Responsive Formset Table (mobile cards) ── */
@media (max-width: 767px) {
    table.formset-table-responsive thead { display: none; }
    table.formset-table-responsive tbody tr {
        display: block;
        margin-bottom: 0.75rem;
        border-radius: 0.5rem;
        border: 1px solid hsl(var(--border));
        background-color: hsl(var(--card));
        padding: 0.75rem;
    }
    table.formset-table-responsive tbody tr:last-child { margin-bottom: 0; }
    table.formset-table-responsive tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-left: 0;
        padding-right: 0;
        padding-top: 0.375rem;
        padding-bottom: 0.375rem;
        border: 0;
    }
    table.formset-table-responsive tbody td::before {
        content: attr(data-label);
        font-weight: 500;
        font-size: 0.875rem;
        line-height: 1.25rem;
        color: hsl(var(--muted-foreground));
        min-width: 6rem;
        flex-shrink: 0;
    }
    table.formset-table-responsive tbody td input,
    table.formset-table-responsive tbody td select,
    table.formset-table-responsive tbody td textarea { flex: 1; min-width: 0; }
    table.formset-table-responsive tbody td[data-label="Select"],
    table.formset-table-responsive tbody td[data-label=""] > input[type="checkbox"] { display: none; }
    table.formset-table-responsive tbody td:last-child {
        justify-content: flex-end;
        padding-top: 0.5rem;
        border-top: 1px solid hsl(var(--border));
        margin-top: 0.25rem;
    }
    table.formset-table-responsive tbody td:last-child::before { display: none; }
}


/* ── Responsive Data Table (mobile cards) ───── */
@media (max-width: 767px) {
    table.data-table-responsive thead { display: none; }
    table.data-table-responsive tbody tr {
        display: block;
        margin-bottom: 0.75rem;
        border-radius: 0.5rem;
        border: 1px solid hsl(var(--border));
        background-color: hsl(var(--card));
        padding: 0.75rem;
    }
    table.data-table-responsive tbody tr:last-child { margin-bottom: 0; }
    table.data-table-responsive tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-left: 0;
        padding-right: 0;
        padding-top: 0.375rem;
        padding-bottom: 0.375rem;
        border: 0;
    }
    table.data-table-responsive tbody td::before {
        content: attr(data-label);
        font-size: 0.75rem;
        line-height: 1rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        font-weight: 500;
        color: hsl(var(--muted-foreground));
        min-width: 6rem;
        flex-shrink: 0;
    }
    table.data-table-responsive tbody td:last-child {
        justify-content: flex-end;
        padding-top: 0.5rem;
        border-top: 1px solid hsl(var(--border));
        margin-top: 0.25rem;
    }
    table.data-table-responsive tbody td:last-child::before { display: none; }
    table.data-table-responsive tbody tr:only-child td[colspan] { display: block; text-align: center; }
    table.data-table-responsive tbody tr:only-child td[colspan]::before { display: none; }
}


/* ── Card header row mobile fix ─────────────── */
@media (max-width: 639px) {
    .card-header-row {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }
}


/* ── Icon container system ──────────────────── */
.icon-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 0.5rem;
}
.icon-container-sm { width: 2.5rem; height: 2.5rem; }
.icon-container-md { width: 3rem; height: 3rem; border-radius: 0.75rem; }
.icon-container-lg { width: 4rem; height: 4rem; border-radius: 1rem; }

.icon-accent {
    background-color: hsl(var(--success) / 0.1);
    color: hsl(var(--success));
}
.icon-info {
    background-color: hsl(var(--info) / 0.1);
    color: hsl(var(--info));
}
.icon-warning {
    background-color: hsl(var(--warning) / 0.1);
    color: hsl(var(--warning));
}
.icon-muted {
    background-color: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
}
.icon-rose {
    background-color: #ffe4e6;
    color: #e11d48;
}
.icon-violet {
    background-color: #ede9fe;
    color: #7c3aed;
}
.icon-primary {
    background-color: hsl(var(--primary) / 0.1);
    color: hsl(var(--primary));
}
.icon-blue {
    background-color: #dbeafe;
    color: #2563eb;
}
.icon-emerald {
    background-color: #d1fae5;
    color: #059669;
}
.icon-orange {
    background-color: #ffedd5;
    color: #ea580c;
}
.icon-gold {
    background: #C8A95120;
    color: #C8A951;
}


/* ── Alert ──────────────────────────────────── */
.alert {
    position: relative;
    width: 100%;
    border-radius: 0.5rem;
    border: 1px solid hsl(var(--border));
    padding: 1rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}
.alert-success {
    border-color: #a7f3d0;
    background-color: #ecfdf5;
    color: #065f46;
}
.alert-error {
    border-color: #fecaca;
    background-color: #fef2f2;
    color: #991b1b;
}
.alert-warning {
    border-color: #fde68a;
    background-color: #fffbeb;
    color: #92400e;
}
.alert-info {
    border-color: #bfdbfe;
    background-color: #eff6ff;
    color: #1e40af;
}
.alert-danger {
    border-color: #fecaca;
    background-color: #fef2f2;
    color: #991b1b;
}

.separator {
    flex-shrink: 0;
    background-color: hsl(var(--border));
    height: 1px;
    width: 100%;
}

.progress-bar {
    position: relative;
    height: 0.5rem;
    width: 100%;
    overflow: hidden;
    border-radius: 9999px;
    background-color: hsl(var(--secondary));
}
.progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
}


/* ── Bootstrap JS compatibility ─────────────── */
.collapse:not(.show) { display: none; }
.collapsing {
    height: 0;
    overflow: hidden;
    transition: height var(--transition-slow) ease-out;
}
.fade {
    opacity: 0;
    transition: opacity var(--transition-base) ease-out;
}
.fade.show { opacity: 1; }

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 50;
    overflow-y: auto;
}
.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
}
.modal-backdrop.show {
    background-color: rgb(0 0 0 / 0.8);
}

.modal-dialog {
    position: relative;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    pointer-events: none;
    max-width: 500px;
}
.modal-dialog.modal-lg { max-width: 800px; }

.modal-content {
    pointer-events: auto;
    border-radius: 0.75rem;
    border: 1px solid hsl(var(--border));
    background-color: hsl(var(--background));
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    transform: scale(0.95) translateY(-8px);
    opacity: 0;
    transition: transform var(--transition-base) ease-out, opacity var(--transition-base) ease-out;
}
.modal.show .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid hsl(var(--border));
}
.modal-body { padding: 1.5rem; }
.modal-footer {
    padding: 1.5rem;
    padding-top: 0;
}
.modal-title {
    font-size: 1.125rem;
    line-height: 1.75rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.025em;
}

.btn-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.125rem;
    opacity: 0.7;
    transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1);
    height: 1.5rem;
    width: 1.5rem;
    padding: 0;
    border: 0;
    background-color: transparent;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M18 6 6 18'/%3E%3Cpath d='m6 6 12 12'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 1rem;
    font-size: 0;
}
.btn-close:hover { opacity: 1; }

.dropdown-menu {
    position: absolute;
    z-index: 50;
    overflow: hidden;
    border-radius: 0.375rem;
    border: 1px solid hsl(var(--border));
    background-color: hsl(var(--popover));
    padding: 0.25rem;
    color: hsl(var(--popover-foreground));
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    min-width: max-content;
    display: block !important;
    opacity: 0;
    transform: scale(0.95) translateY(-4px);
    transform-origin: top right;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition-fast) ease-out, transform var(--transition-fast) ease-out, visibility 0s var(--transition-fast);
}
.dropdown-menu.show {
    opacity: 1;
    transform: scale(1) translateY(0);
    visibility: visible;
    pointer-events: auto;
    transition: opacity var(--transition-fast) ease-out, transform var(--transition-fast) ease-out, visibility 0s;
}

.dropdown-item {
    position: relative;
    display: flex;
    cursor: pointer;
    user-select: none;
    align-items: center;
    border-radius: 0.125rem;
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    outline: none;
    transition: color 150ms cubic-bezier(0.4, 0, 0.2, 1), background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}
.dropdown-item:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.dropdown-divider {
    margin: 0.25rem -0.25rem;
    height: 1px;
    background-color: hsl(var(--muted));
}

.dropdown-menu-end { right: 0; left: auto; }

.dropdown [data-bs-toggle="dropdown"] svg:last-child {
    transition: transform var(--transition-base) ease-out;
}
.dropdown [data-bs-toggle="dropdown"][aria-expanded="true"] svg:last-child {
    transform: rotate(180deg);
}


/* ── Mobile nav toggle ──────────────────────── */
@media (max-width: 1023px) {
    .mobile-nav-collapse {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 50;
        border-top: 1px solid hsl(var(--border));
        background-color: hsl(var(--background) / 0.95);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
        box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
        padding: 0.75rem 1rem;
    }
    .mobile-nav-collapse.show { display: flex; }
}
@media (min-width: 1024px) {
    .mobile-nav-collapse { display: none !important; }
}

.tooltip {
    position: absolute;
    z-index: 50;
}
.tooltip .tooltip-inner {
    border-radius: 0.375rem;
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    line-height: 1rem;
}
.tooltip .tooltip-arrow { display: none; }


/* ── Form compatibility ─────────────────────── */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="url"], input[type="date"],
input[type="tel"], textarea, select {
    font-size: 0.875rem;
    line-height: 1.25rem;
    border: 1px solid hsl(var(--input));
    background-color: hsl(var(--background));
    border-radius: 0.5rem;
}
input[type="text"]:focus-visible, input[type="email"]:focus-visible,
input[type="password"]:focus-visible, input[type="number"]:focus-visible,
input[type="url"]:focus-visible, input[type="date"]:focus-visible,
input[type="tel"]:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}

textarea:not(.textarea):not(.input) {
    min-height: 80px;
    height: auto;
}

select:not(.select):not(.input) {
    padding-right: 2.5rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236e7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.625rem center;
    background-size: 1rem;
}
select:not(.select):not(.input):focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230D4F4F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

input[type="checkbox"] {
    height: 1rem;
    width: 1rem;
    flex-shrink: 0;
    border-radius: 0.125rem;
    border: 1px solid hsl(var(--primary));
}
input[type="checkbox"]:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}

label {
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    line-height: 1;
}

input.is-invalid, select.is-invalid, textarea.is-invalid {
    border-color: hsl(var(--destructive));
}
input.is-invalid:focus-visible, select.is-invalid:focus-visible, textarea.is-invalid:focus-visible {
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--destructive));
}


/* ── Compliance score badge ─────────────────── */
.score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1.75rem;
}
.score-badge--high {
    background-color: #d1fae5;
    color: #065f46;
}
.score-badge--medium {
    background-color: #fef3c7;
    color: #92400e;
}
.score-badge--low {
    background-color: #fee2e2;
    color: #991b1b;
}


/* ── Auth divider ───────────────────────────── */
.auth-divider {
    display: flex;
    align-items: center;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
    line-height: 1.25rem;
}
.auth-divider::before, .auth-divider::after {
    content: "";
    flex: 1 1 0%;
    border-bottom: 1px solid hsl(var(--border));
}
.auth-divider::before { margin-right: 0.5rem; }
.auth-divider::after { margin-left: 0.5rem; }


/* ── Animations ─────────────────────────────── */
@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes alertSlideIn {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fade-in-up var(--transition-slow) ease-out; }
.alert.animate-in { animation: alertSlideIn 0.3s ease-out; }

a.card:focus-visible, .card-interactive:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}
.dropdown-item:focus-visible {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
    outline: none;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}


/* ── Bootstrap form-control/form-select compat ── */
.form-control {
    display: flex;
    height: 2.5rem;
    width: 100%;
    border-radius: 0.5rem;
    border: 1px solid hsl(var(--input));
    background-color: hsl(var(--background));
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
}
.form-control::placeholder {
    color: hsl(var(--muted-foreground));
}
.form-control:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}

.form-select {
    display: flex;
    height: 2.5rem;
    width: 100%;
    border-radius: 0.5rem;
    border: 1px solid hsl(var(--input));
    background-color: hsl(var(--background));
    padding: 0.5rem 0.75rem;
    padding-right: 2.5rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    cursor: pointer;
}
.form-select:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}


/* ── Enhanced select ────────────────────────── */
.select-enhanced { position: relative; }
.select-enhanced .select-trigger {
    display: flex;
    height: 2.5rem;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    border-radius: 0.5rem;
    border: 1px solid hsl(var(--input));
    background-color: hsl(var(--background));
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    cursor: pointer;
}
.select-enhanced .select-trigger:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}
.select-enhanced .select-trigger.is-invalid {
    border-color: hsl(var(--destructive));
}
.select-enhanced .select-trigger svg {
    flex-shrink: 0;
    opacity: 0.5;
    transition: transform var(--transition-fast) ease;
}
.select-enhanced .select-panel {
    position: absolute;
    z-index: 50;
    margin-top: 0.25rem;
    max-height: 15rem;
    width: 100%;
    overflow: auto;
    border-radius: 0.375rem;
    border: 1px solid hsl(var(--border));
    background-color: hsl(var(--popover));
    padding: 0.25rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    opacity: 0;
    transform: scale(0.95) translateY(-4px);
    transition: opacity var(--transition-fast) ease-out, transform var(--transition-fast) ease-out;
}
.select-enhanced .select-panel[style*="display: none"] {
    opacity: 0;
    transform: scale(0.95) translateY(-4px);
}
.select-enhanced .select-panel:not([style*="display: none"]) {
    opacity: 1;
    transform: scale(1) translateY(0);
}
.select-enhanced .select-option {
    display: flex;
    cursor: pointer;
    padding: 0.375rem 0.5rem;
    border-radius: 0.125rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
}
.select-enhanced .select-option:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}
.select-enhanced .select-option.selected,
.select-enhanced .select-option[aria-selected="true"] {
    font-weight: 600;
    color: hsl(var(--primary));
}
.select-enhanced .select-optgroup {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: hsl(var(--muted-foreground));
    padding: 0.5rem 0.5rem 0.25rem;
}

/* ── Styled confirmation modal ─────────────── */
.confirm-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    background-color: rgb(0 0 0 / 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-base) ease-out;
}
.confirm-modal-backdrop.show { opacity: 1; }
.confirm-modal-card {
    background-color: hsl(var(--background));
    border-radius: 0.75rem;
    border: 1px solid hsl(var(--border));
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    max-width: 400px;
    width: calc(100% - 2rem);
    padding: 1.5rem;
    transform: scale(0.95) translateY(-8px);
    opacity: 0;
    transition: transform var(--transition-base) ease-out, opacity var(--transition-base) ease-out;
}
.confirm-modal-backdrop.show .confirm-modal-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}


/* ── Horizontal nav links (CivilHub pattern) ── */
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    transition: color var(--transition-fast) ease, background-color var(--transition-fast) ease;
}
.nav-link:hover {
    color: hsl(var(--accent-foreground));
    background-color: hsl(var(--accent) / 0.1);
}
.nav-link-active {
    color: hsl(var(--primary));
    border-bottom: 2px solid hsl(var(--primary));
    border-radius: 0.375rem 0.375rem 0 0;
}

/* ── Layout: no sidebar, mobile bottom padding ── */
@media (max-width: 1023px) {
    body { padding-bottom: 4.5rem; }
}
