/* ─── Alpine.js FOUC prevention ─── */
[x-cloak] { display: none !important; }

/* ─── Base Input ─── */
.app-input {
    display: block;
    width: 100%;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: #111827;
    background-color: #ffffff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.app-input:focus {
    outline: none;
    border-color: var(--color-primary-500);
    box-shadow: 0 0 0 3px rgba(27, 143, 188, 0.12);
}
.app-input::placeholder {
    color: #9ca3af;
}
.app-input:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.7;
}
.app-input.input-error {
    border-color: #ef4444;
}
.app-input.input-error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

/* ─── Buttons ─── */
.app-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
    text-decoration: none;
}
.app-btn:active {
    transform: scale(0.98);
}
.app-btn-primary {
    background-color: var(--color-primary-600);
    color: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.app-btn-primary:hover {
    background-color: var(--color-primary-700);
    box-shadow: 0 4px 12px rgba(13, 70, 85, 0.25);
}
.app-btn-secondary {
    background-color: white;
    color: #374151;
    border: 1px solid #d1d5db;
}
.app-btn-secondary:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
}
.app-btn-danger {
    background-color: #ef4444;
    color: white;
}
.app-btn-danger:hover {
    background-color: #dc2626;
}
.app-btn:disabled,
.app-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ─── Card ─── */
.app-card {
    background-color: white;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* ─── Modal ─── */
.app-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 1rem;
}
.app-modal {
    width: 100%;
    max-width: 28rem;
    border-radius: 0.75rem;
    background-color: #ffffff;
    padding: 1.5rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}
.app-modal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.app-modal-icon {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
}
.app-modal-body {
    margin-bottom: 1.5rem;
}
.app-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ─── Input hint ─── */
.app-input-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    line-height: 1rem;
    color: #6b7280;
}
.app-input-hint.error {
    color: #ef4444;
}

/* ─── Table ─── */
.app-table {
    width: 100%;
    border-collapse: collapse;
}
.app-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    border-bottom: 2px solid #e5e7eb;
}
.app-table td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
}
.app-table tr:hover {
    background-color: #f9fafb;
}

/* ─── Sidebar (dark theme) ─── */
.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--sidebar-text);
    transition: all 0.15s ease;
    text-decoration: none;
    cursor: pointer;
}
.sidebar-nav-item:hover {
    background-color: var(--sidebar-hover-bg);
    color: var(--sidebar-text-active);
}
.sidebar-nav-item.active {
    background-color: rgba(27, 143, 188, 0.15);
    color: var(--sidebar-text-active);
    font-weight: 500;
}
.sidebar-nav-item .material-symbols-outlined {
    font-size: 1.25rem;
    opacity: 0.7;
}
.sidebar-nav-item:hover .material-symbols-outlined,
.sidebar-nav-item.active .material-symbols-outlined {
    opacity: 1;
}

.sidebar-section-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-section-text);
    padding: 1.25rem 0.75rem 0.375rem;
}

/* ─── User avatar ─── */
.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    font-weight: 600;
    text-transform: uppercase;
}
.user-avatar-sm {
    width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
}
.user-avatar-md {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 0.8125rem;
}
.user-avatar-lg {
    width: 3rem;
    height: 3rem;
    font-size: 1rem;
}

/* ─── Radio group (styled) ─── */
.radio-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.875rem;
    color: #374151;
    background-color: white;
}
.radio-card:hover {
    border-color: var(--color-primary-300);
    background-color: var(--color-primary-50);
}
.radio-card.selected {
    border-color: var(--color-primary-500);
    background-color: var(--color-primary-50);
    color: var(--color-primary-800);
    font-weight: 500;
}

/* ─── Password strength indicator ─── */
.password-strength-bar {
    height: 4px;
    border-radius: 2px;
    background-color: #e5e7eb;
    overflow: hidden;
    transition: all 0.3s ease;
}
.password-strength-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

/* ─── Dropdown menu ─── */
.dropdown-menu {
    position: absolute;
    right: 0;
    z-index: 50;
    margin-top: 0.5rem;
    min-width: 12rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    background-color: white;
    padding: 0.25rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.05);
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    color: #374151;
    border-radius: 0.375rem;
    text-decoration: none;
    transition: background-color 0.1s;
}
.dropdown-item:hover {
    background-color: #f3f4f6;
}
.dropdown-item-danger {
    color: #ef4444;
}
.dropdown-item-danger:hover {
    background-color: #fef2f2;
}

/* ─── Tom Select overrides ─── */
.ts-wrapper .ts-control {
    border: 1px solid #d1d5db !important;
    border-radius: 0.5rem !important;
    padding: 0.375rem 0.75rem !important;
    font-size: 0.875rem !important;
    line-height: 1.25rem !important;
    min-height: 2.375rem !important;
    box-shadow: none !important;
    background-color: #ffffff !important;
    color: #111827 !important;
    transition: border-color 0.15s, box-shadow 0.15s !important;
}
.ts-wrapper.focus .ts-control {
    border-color: var(--color-primary-500) !important;
    box-shadow: 0 0 0 3px rgba(27, 143, 188, 0.12) !important;
}
.ts-wrapper .ts-dropdown {
    border-radius: 0.5rem !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
    margin-top: 4px !important;
}
.ts-wrapper .ts-dropdown .option {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.875rem !important;
}
.ts-wrapper .ts-dropdown .option.active {
    background-color: var(--color-primary-50) !important;
    color: var(--color-primary-800) !important;
}
/* Single-select with dropdown_input: clean display */
.ts-wrapper.single .ts-control .item {
    color: #111827 !important;
    max-width: 100% !important;
    text-overflow: ellipsis !important;
    overflow: hidden !important;
    white-space: nowrap !important;
}
.ts-wrapper .ts-control input::placeholder {
    color: #9ca3af !important;
}
/* Search input inside dropdown */
.ts-wrapper .ts-dropdown .dropdown-input-wrap {
    padding: 6px 8px !important;
    border-bottom: 1px solid #e5e7eb !important;
}
.ts-wrapper .ts-dropdown .dropdown-input {
    border: 1px solid #d1d5db !important;
    border-radius: 0.375rem !important;
    padding: 0.375rem 0.625rem !important;
    font-size: 0.8125rem !important;
    width: 100% !important;
    outline: none !important;
}
.ts-wrapper .ts-dropdown .dropdown-input:focus {
    border-color: var(--color-primary-500) !important;
    box-shadow: 0 0 0 2px rgba(27, 143, 188, 0.12) !important;
}

/* ─── Flatpickr overrides ─── */
.flatpickr-calendar {
    border-radius: 0.5rem !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
    border-color: #e5e7eb !important;
}
.flatpickr-day.selected {
    background: var(--color-primary-600) !important;
    border-color: var(--color-primary-600) !important;
}
.flatpickr-day:hover {
    background: var(--color-primary-50) !important;
    border-color: var(--color-primary-50) !important;
}
/* Flatpickr — alt inputs en filtros de formulario (readonly pero clickeables) */
input.app-input.flatpickr-input[readonly] {
    cursor: pointer;
    background-color: #ffffff;
}

/* Date range picker — Flatpickr alt inputs inherit from original, style the visible alt */
#date-range-picker input.flatpickr-alt {
    width: 100px;
    border: 0;
    background: transparent;
    padding: 0.25rem 0;
    font-size: 0.75rem;
    font-weight: 500;
    color: #374151;
    outline: none;
    cursor: pointer;
}
#date-range-picker input.flatpickr-alt::placeholder {
    color: #9ca3af;
}

/* ─── Scrollbar (sidebar) ─── */
.sidebar-scroll::-webkit-scrollbar {
    width: 4px;
}
.sidebar-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}
.sidebar-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ─── OTP / TOTP code input ─── */
.app-otp-input {
    display: block;
    width: 100%;
    max-width: 14rem;
    margin-left: auto;
    margin-right: auto;
    border-radius: 0.5rem;
    border: 2px solid #e5e7eb;
    padding: 0.625rem 0.75rem;
    font-size: 1.5rem;
    line-height: 2rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 600;
    letter-spacing: 0.5em;
    text-align: center;
    color: #111827;
    background-color: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.app-otp-input:focus {
    outline: none;
    border-color: var(--color-primary-500);
    box-shadow: 0 0 0 3px rgba(27, 143, 188, 0.15);
}
.app-otp-input::placeholder {
    color: #d1d5db;
    letter-spacing: 0.4em;
    font-weight: 400;
}
.app-otp-input.otp-filled {
    border-color: var(--color-primary-500);
    background-color: var(--color-primary-50);
}

/* ─── Transition utilities ─── */
.fade-enter {
    opacity: 0;
    transform: translateY(-4px);
}
.fade-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.15s ease;
}
