/**
 * Spark Component Library
 * Standardized UI components for the entire application
 */

/* ============================================
   CARDS & CONTAINERS
   ============================================ */
.spark-card {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-6);
    transition: var(--transition-base);
}

.spark-card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ============================================
   TABLES
   ============================================ */
.spark-table-container {
    overflow-x: auto;
    background: var(--color-bg-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-light);
}

.spark-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-bg-primary);
}

.spark-table th {
    padding: var(--spacing-4) var(--spacing-5);
    text-align: left;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-widest);
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border-light);
    white-space: nowrap;
}

.spark-table td {
    padding: var(--spacing-4) var(--spacing-5);
    font-size: var(--font-size-sm);
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border-light);
    vertical-align: middle;
}

.spark-table tbody tr:hover {
    background: var(--color-bg-secondary);
}

/* ============================================
   BADGES & STATUS
   ============================================ */
.spark-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    padding: var(--spacing-1) var(--spacing-3);
    border-radius: var(--radius-sm, 4px); /* Flat Fluent */
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    transition: var(--transition-fast);
}

.spark-badge-success {
    background: #ecfdf5; /* emerald-50 */
    color: #059669; /* emerald-600 */
    border: 1px solid #6ee7b7; /* emerald-300 */
}

.spark-badge-warning {
    background: #fffbeb; /* amber-50 */
    color: #d97706; /* amber-600 */
    border: 1px solid #fcd34d; /* amber-300 */
}

.spark-badge-danger {
    background: var(--status-rejected-bg);
    color: var(--status-rejected);
    border: none;
}

/* ============================================
   FORM CONTROLS
   ============================================ */
.spark-input-group {
    margin-bottom: var(--spacing-4);
}

.spark-label {
    display: block;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-2);
    text-transform: uppercase;
}

.spark-input,
.spark-select {
    width: 100%;
    height: var(--height-control-lg);
    padding: 0 var(--spacing-4);
    font-size: var(--font-size-sm);
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-medium);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.spark-input:focus,
.spark-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.1);
}

/* ============================================
   NAVBAR
   ============================================ */
.spark-navbar {
    background: var(--navbar-gradient, linear-gradient(161deg, #020024 0%, #090979 35%, #26164f 100%));
    padding: var(--spacing-2) var(--spacing-6);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.spark-nav-link {
    color: rgba(255, 255, 255, 0.9);
    padding: var(--spacing-2) var(--spacing-4);
    border-radius: var(--radius-full);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    transition: var(--transition-base);
}

.spark-nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-white);
}

/* ============================================
   SIDEBAR
   ============================================ */
.spark-sidebar {
    width: var(--sidebar-width);
    background: var(--color-bg-primary);
    border-right: 1px solid var(--color-border-light);
    height: 100vh;
    overflow-y: auto;
    transition: var(--transition-base);
}

.spark-sidebar-item {
    padding: var(--spacing-3) var(--spacing-5);
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    color: var(--color-text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    margin: var(--spacing-1) var(--spacing-2);
}

.spark-sidebar-item:hover {
    background: var(--color-bg-secondary);
    color: var(--color-primary);
}

.spark-sidebar-item.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: var(--font-weight-semibold);
}

/* ============================================
   UNIVERSAL MAPPING (The Bridge)
   Applying the Spark look to all existing classes
   ============================================ */

/* Global Card Refresh */
.card,
.card-body {
    background: var(--color-bg-primary) !important;
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--color-border-light) !important;
    box-shadow: var(--shadow-sm) !important;
}

/* Global Table Refresh */
table:not([class*="calendar"]),
.table:not([class*="calendar"]) {
    width: 100% !important;
    border-collapse: collapse !important;
}

.table th {
    background: var(--color-bg-secondary) !important;
    color: var(--color-text-secondary) !important;
    font-size: var(--font-size-xs) !important;
    text-transform: uppercase !important;
    letter-spacing: var(--letter-spacing-widest) !important;
    padding: var(--spacing-3) var(--spacing-4) !important;
}

/* Global Form Refresh */
.form-control,
.form-select,
.spark-input,
.spark-select,
input[type="text"]:not(.swal2-input),
input[type="email"],
input[type="password"],
input[type="date"],
select:not(.swal2-select) {
    height: 32px !important;
    padding: 0 12px !important;
    font-size: 0.8125rem !important;
    color: #323130 !important;
    background: #ffffff !important;
    border: 1px solid #edebe9 !important;
    border-radius: var(--radius-md) !important;
    transition: all 0.15s ease !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08) !important;
    line-height: normal !important;
}

.form-control:hover,
.form-select:hover,
.spark-input:hover,
.spark-select:hover {
    border-color: #a19f9d !important;
}

.form-control:focus,
.form-select:focus,
.spark-input:focus,
.spark-select:focus {
    outline: none !important;
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 1px var(--color-primary), 0 2px 4px rgba(0, 0, 0, 0.05) !important;
}

/* Labels Restoration */
.spark-label,
label:not(.btn):not(.flex):not(.block):not([class*="checkbox"]):not(.commune-check-row):not(.zone-select-label):not(.spark-archive-month-item) {
    display: block !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    color: #605e5c !important;
    margin-bottom: 4px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}

/* Modern checkbox list component */
.spark-checkbox-list {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    max-height: 260px;
    overflow-y: auto;
    padding: 0.3rem;
}

label.spark-checkbox-row {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start;
    gap: 0.7rem;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0.6rem 0.7rem;
    min-height: 2.5rem;
    margin: 0 !important;
    cursor: pointer;
    user-select: none;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    color: inherit !important;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

label.spark-checkbox-row:hover {
    background: #f8fafc;
    border-color: #e5e7eb;
}

label.spark-checkbox-row.is-selected {
    background: #eff6ff;
    border-color: #bfdbfe;
}

label.spark-checkbox-row>input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    margin: 0 !important;
    accent-color: #0F4C81;
    flex: 0 0 18px;
    align-self: center;
}

label.spark-checkbox-row .spark-checkbox-text {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0 !important;
    font-size: 0.96rem;
    font-weight: 600;
    line-height: 1.25;
    color: #1f2937;
    text-transform: none;
}

@media (max-width: 900px) {
    .spark-checkbox-list {
        max-height: 200px;
    }
}

.form-select,
.spark-select {
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23605e5c' d='M2.5 4.5L6 8l3.5-3.5H2.5z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    padding-right: 32px !important;
}


/* Global Navbar Refresh */
.navbar,
.navbar-spark {
    background: var(--navbar-gradient, linear-gradient(161deg, #020024 0%, #090979 35%, #26164f 100%)) !important;
    border: none !important;
    box-shadow: var(--shadow-md) !important;
}

/* ==========================================================================
   GLOBAL SIDE PANEL SYSTEM
   ========================================================================== */

.global-side-panel {
    position: fixed;
    top: 0;
    right: -80%;
    width: 80%;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    background: #ffffff;
    z-index: 6500;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    transition: right 0.4s ease-in-out;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.global-side-panel.open {
    right: 0;
}

.side-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 6400;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.side-panel-overlay.active {
    opacity: 1;
    visibility: visible;
}

.side-panel-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 1rem;
    color: #605e5c;
}

/* Responsive side panel */
@media (max-width: 1024px) {
    .global-side-panel,
    .global-side-panel-loader {
        width: 100%;
    }

    .global-side-panel {
        right: -100%;
    }
}

/* ==========================================================================
   SIDE PANEL CONTENT - EMPLOYEE VIEW LAYOUT
   ========================================================================== */

.employee-view-container {
    display: flex;
    flex-direction: row;
    /* Force horizontal layout */
    height: 100%;
    /* Fill the global-side-panel height */
    width: 100%;
    overflow: hidden;
}

.employee-view-sidebar {
    width: 280px;
    background: #f8f9fa;
    border-right: 1px solid var(--color-border-light, #e0e0e0);
    display: flex;
    flex-direction: column;
    padding: 0.35rem 0 0;
    flex-shrink: 0;
    height: 100%;
}

.employee-view-header {
    padding: 0.85rem 1.5rem 1.2rem;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 0.75rem;
}

.employee-view-avatar {
    width: 64px;
    height: 64px;
    background: var(--color-primary, #0078d4);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0.35rem auto 0.9rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.employee-view-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.employee-view-position {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    font-weight: 600;
    margin: 0;
}

.employee-view-nav {
    flex: 1;
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.employee-view-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #475569;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.employee-view-nav .nav-item i {
    width: 1.25rem;
    text-align: center;
    font-size: 1rem;
}

.employee-view-nav .nav-item:hover {
    background: #f1f5f9;
    color: var(--color-primary, #0078d4);
}

.employee-view-nav .nav-item.active {
    background: var(--color-primary, #0078d4);
    color: white;
}

.employee-view-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid #e2e8f0;
}

.employee-sidebar-bottom {
    margin-top: auto;
}

.employee-sidebar-brand {
    padding: 0.75rem 1rem 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.employee-sidebar-brand-logo {
    height: 160px;
    width: auto;
    opacity: 0.92;
    display: block;
    margin: 0 auto;
}

.employee-sidebar-brand-logo-skeleton {
    height: 180px;
}

.employee-view-footer-inline {
    display: flex;
    gap: 10px;
    background: #f8fafc;
}

[data-side-panel-submit] {
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

[data-side-panel-submit].is-saving {
    pointer-events: none;
    opacity: 0.95;
}

.side-panel-submit-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 999px;
    animation: spark-spin 0.7s linear infinite;
    flex-shrink: 0;
}

[data-side-panel-submit].is-saving .side-panel-submit-spinner {
    display: inline-flex;
}

[data-side-panel-submit].is-saving [data-side-panel-submit-icon] {
    display: none;
}

.employee-view-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: #ffffff;
    scroll-behavior: smooth;
    height: 100%;
    position: relative;
}

/* Close Button Overlay */
.side-panel-close-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #475569;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.15s ease;
}

.side-panel-close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: scale(1.1);
}

.detail-section {
    margin-bottom: 2rem;
}

.section-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.section-card-header {
    background: #f8fafc;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
}

.section-card-header h3 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.section-card-header h3 i {
    color: var(--color-primary, #0078d4);
    font-size: 0.875rem;
}

.section-card-body {
    padding: 1.25rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem 2rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-item.full-width {
    grid-column: span 2;
}

.info-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-value {
    font-size: 0.9375rem;
    color: #1e293b;
    font-weight: 500;
}

.notes-text {
    line-height: 1.6;
    color: #475569;
    white-space: pre-line;
    font-size: 0.875rem;
}

/* Status Badges in Side Panel */
.global-side-panel .status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    gap: 0.375rem;
}

.global-side-panel .status-active {
    background: #dcfce7;
    color: #15803d;
}

.global-side-panel .status-inactive {
    background: #fee2e2;
    color: #b91c1c;
}

/* Responsive side panel content */
@media (max-width: 1024px) {

    /* Tablet specific scaling (min-width logic handled by overriding below) */
    .employee-view-sidebar {
        width: 80px;
        padding: 1rem 0;
    }

    .employee-view-header h2,
    .employee-view-header p,
    .employee-view-nav span,
    .employee-view-footer span,
    .employee-view-nav .nav-item {
        justify-content: center;
    }

    .employee-view-nav .nav-item {
        font-size: 0;
    }

    .employee-view-nav .nav-item i {
        font-size: 1.25rem;
        width: auto;
    }

    .employee-view-header h2,
    .employee-view-header p {
        display: none;
    }

    .employee-view-avatar {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }
}

@media (max-width: 768px) {

    /* Use small viewport height on phones so browser UI (address/search bar) does not cover actions */
    .global-side-panel {
        height: 100svh;
        max-height: 100svh;
    }

    /* Mobile specific layout: Stack vertically instead of squishing */
    .employee-view-container {
        flex-direction: column;
        position: relative;
    }

    .employee-view-sidebar {
        width: 100%;
        height: auto;
        flex-shrink: 0;
        padding: 0;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }

    /* Transform header to a top bar */
    .employee-view-header {
        display: grid;
        grid-template-columns: 48px 1fr;
        grid-template-rows: auto auto;
        gap: 0.2rem 1rem;
        padding: 1rem;
        padding-right: 4rem;
        /* Leave space for close button */
        text-align: left;
        margin-bottom: 0;
        border-bottom: none;
    }

    .employee-view-header h2 {
        display: block;
        /* Override tablet hidden */
        grid-row: 1;
        grid-column: 2;
        align-self: end;
        margin: 0;
        font-size: 1.15rem;
    }

    .employee-view-header p {
        display: block;
        /* Override tablet hidden */
        grid-row: 2;
        grid-column: 2;
        align-self: start;
        margin: 0;
        font-size: 0.8rem;
    }

    .employee-view-avatar {
        grid-row: 1 / 3;
        grid-column: 1;
        width: 48px;
        height: 48px;
        margin: 0;
        font-size: 1.25rem;
        align-self: center;
    }

    /* Horizontal scroll for navigation tabs */
    .employee-view-nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 0 1rem 0.75rem;
        gap: 0.5rem;
        scrollbar-width: none;
        /* Hide scrollbar Firefox */
    }

    .employee-view-nav::-webkit-scrollbar {
        display: none;
        /* Hide scrollbar Chrome/Safari */
    }

    .employee-view-nav .nav-item {
        font-size: 0.875rem;
        /* Show text */
        white-space: nowrap;
        padding: 0.5rem 1rem;
        flex-shrink: 0;
        justify-content: flex-start;
        background: #f1f5f9;
    }

    .employee-view-nav .nav-item.active {
        background: var(--color-primary, #0078d4);
    }

    .employee-view-nav .nav-item i {
        font-size: 1rem;
        margin-right: 0.5rem;
        width: auto;
    }

    .employee-view-nav .nav-item span {
        display: inline;
    }

    /* Hide large logo */
    .employee-sidebar-brand {
        display: none;
    }

    /* Keep action bar visible above form fields and dropdown overlays */
    .employee-sidebar-bottom {
        position: absolute;
        bottom: env(safe-area-inset-bottom, 0);
        left: 0;
        width: 100%;
        background: white;
        z-index: 1200;
        box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
        border-top: 1px solid #e2e8f0;
        padding-bottom: max(env(safe-area-inset-bottom, 0), 0.5rem);
    }

    .employee-view-footer {
        padding: 0.75rem 1rem;
        border-top: none;
    }

    .employee-view-footer button > span,
    .employee-view-footer .btn-content {
        display: flex;
        /* Override tablet hidden */
        align-items: center;
        width: 100%;
    }

    /* Adjust form layout and space for footer */
    .employee-view-content {
        padding: 1.25rem;
        padding-bottom: calc(7.5rem + env(safe-area-inset-bottom, 0));
        /* Space for pinned mobile action bar */
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .info-item.full-width {
        grid-column: span 1;
    }

    .side-panel-close-btn {
        top: 1rem;
        right: 1rem;
        background: #e2e8f0;
    }
}

/* ==========================================================================
   SKELETON LOADING SYSTEM
   ========================================================================== */

.skeleton-shimmer {
    background: linear-gradient(90deg,
            #f0f0f0 25%,
            #f8f8f8 50%,
            #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite linear;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    from {
        background-position: 200% 0;
    }

    to {
        background-position: -200% 0;
    }
}

.skeleton-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 0.75rem;
}

.skeleton-text {
    height: 12px;
    margin-bottom: 0.5rem;
    width: 100%;
}

.skeleton-title {
    height: 20px;
    margin-bottom: 1rem;
    width: 60%;
}

.skeleton-nav-item {
    height: 36px;
    margin-bottom: 0.5rem;
    border-radius: 6px;
}

.skeleton-card-mock {
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.side-panel-logo-container {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    border-top: 1px solid #e2e8f0;
}

/* ==========================================================================
   CUSTOM SEARCHABLE SELECT
   ========================================================================== */
.searchable-select-container {
    position: relative;
    width: 100%;
    z-index: 1;
    /* Low base z-index */
}

.searchable-select-container.is-active {
    z-index: 1001;
    /* Elevate above other form elements when open */
}

.searchable-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 32px;
    padding: 0 12px;
    background: #ffffff;
    border: 1px solid #edebe9;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8125rem;
    color: #323130;
    transition: all 0.15s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.searchable-select-trigger:hover {
    border-color: #a19f9d;
}

.searchable-select-trigger:focus {
    outline: none;
    border-color: var(--color-primary, #0078d4);
    box-shadow: 0 0 0 1px var(--color-primary, #0078d4);
}

.searchable-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 1100;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    pointer-events: none;
}

.searchable-select-dropdown.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.searchable-select-search {
    padding: 8px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
}

.searchable-select-search i {
    color: #94a3b8;
    font-size: 0.875rem;
}

.searchable-select-search input {
    border: none !important;
    background: transparent !important;
    padding: 4px 0 !important;
    height: auto !important;
    width: 100% !important;
    font-size: 0.875rem !important;
    box-shadow: none !important;
    outline: none !important;
}

.searchable-select-options {
    max-height: 240px;
    overflow-y: auto;
    padding: 4px;
}

.searchable-select-option {
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: background 0.15s ease;
}

.searchable-select-option:hover,
.searchable-select-option.focused {
    background: #f1f5f9;
}

.searchable-select-option.active {
    background: #eff6ff;
    color: var(--color-primary, #0078d4);
}

.option-code {
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
}

.option-name {
    font-size: 0.875rem;
    font-weight: 500;
}

.searchable-select-option.active .option-code {
    color: var(--color-primary, #0078d4);
    opacity: 0.8;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   BUTTON LOADING STATE
   ========================================================================== */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

.btn-loading .btn-content {
    visibility: hidden;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spark-spin 0.6s linear infinite;
}

@keyframes spark-spin {
    to {
        transform: rotate(360deg);
    }
}

/* SPARK Fluent inputs */
.spark-input,
.spark-select,
.spark-textarea {
    width: 100%;
    height: 32px;
    padding: 0 12px;
    font-size: 0.875rem;
    color: #1f2937;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 2px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: none;
}

.spark-input:focus,
.spark-select:focus,
.spark-textarea:focus {
    outline: none;
    border-color: #1e3a5f;
    box-shadow: 0 0 0 1px rgba(30, 58, 95, 0.3);
}

.spark-input::placeholder {
    color: #94a3b8;
}

.spark-textarea {
    height: auto;
    min-height: 64px;
    padding: 8px 12px;
    resize: vertical;
}

.spark-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}
