/* ============================================================
   MY BOOKING SYSTEM - Components Library
   Buttons · Forms · Cards · Tables · Badges · Modals · etc.
   @version 1.0.0
   ============================================================ */

/* ============================================================
   1. BUTTONS
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0 var(--space-4);
    height: 40px;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    line-height: 1;
    letter-spacing: var(--tracking-tight);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-primary);
    transition: all var(--dur-fast) var(--ease-out);
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* -------- Primary -------- */
.btn-primary {
    background: var(--primary-600);
    color: #fff;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.20);
}
.btn-primary:hover {
    background: var(--primary-700);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.20);
}

/* -------- Secondary -------- */
.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border);
    box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* -------- Ghost -------- */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

/* -------- Outline Primary -------- */
.btn-outline-primary {
    background: transparent;
    color: var(--primary-600);
    border-color: var(--primary-600);
}
.btn-outline-primary:hover {
    background: var(--primary-600);
    color: #fff;
}

/* -------- Danger -------- */
.btn-danger {
    background: var(--danger-500);
    color: #fff;
}
.btn-danger:hover {
    background: var(--danger-600);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

/* -------- Success -------- */
.btn-success {
    background: var(--success-500);
    color: #fff;
}
.btn-success:hover {
    background: var(--success-600);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

/* -------- Warning -------- */
.btn-warning {
    background: var(--warning-500);
    color: #fff;
}
.btn-warning:hover {
    background: var(--warning-600);
}

/* -------- Soft Variants -------- */
.btn-soft-primary {
    background: var(--primary-soft);
    color: var(--primary-700);
}
.btn-soft-primary:hover {
    background: var(--primary-100);
}

.btn-soft-danger {
    background: var(--danger-soft);
    color: var(--danger-600);
}
.btn-soft-danger:hover {
    background: var(--danger-100);
}

.btn-soft-success {
    background: var(--success-soft);
    color: var(--success-600);
}
.btn-soft-success:hover {
    background: var(--success-100);
}

/* -------- Sizes -------- */
.btn-sm {
    height: 32px;
    padding: 0 var(--space-3);
    font-size: var(--fs-xs);
    border-radius: var(--radius-sm);
}
.btn-sm svg { width: 14px; height: 14px; }

.btn-lg {
    height: 48px;
    padding: 0 var(--space-6);
    font-size: var(--fs-body);
    border-radius: var(--radius-md);
}

/* -------- Icon only -------- */
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius);
    color: var(--text-secondary);
    background: transparent;
}
.btn-icon:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}
.btn-icon.btn-sm { width: 32px; height: 32px; }

/* -------- Block -------- */
.btn-block {
    width: 100%;
    display: flex;
}

/* -------- Loading state -------- */
.btn.loading {
    color: transparent !important;
    pointer-events: none;
}
.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    color: #fff;
    opacity: 0.9;
}

/* -------- Button group -------- */
.btn-group {
    display: inline-flex;
    gap: 0;
}
.btn-group .btn {
    border-radius: 0;
    margin-inline-start: -1px;
}
.btn-group .btn:first-child {
    border-start-start-radius: var(--radius);
    border-end-start-radius: var(--radius);
    margin-inline-start: 0;
}
.btn-group .btn:last-child {
    border-start-end-radius: var(--radius);
    border-end-end-radius: var(--radius);
}

/* ============================================================
   2. FORMS
   ============================================================ */

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.form-label {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.form-label.required::after {
    content: '*';
    color: var(--danger-500);
    font-size: 14px;
}

.form-hint {
    font-size: var(--fs-xs);
    color: var(--text-tertiary);
    line-height: 1.4;
}

.form-error {
    font-size: var(--fs-xs);
    color: var(--danger-600);
    font-weight: var(--fw-medium);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0 var(--space-3);
    height: 42px;
    font-size: var(--fs-body);
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: all var(--dur-fast) var(--ease-out);
    line-height: 1.4;
}

.form-textarea {
    min-height: 100px;
    height: auto;
    padding: var(--space-3);
    resize: vertical;
    line-height: var(--lh-relaxed);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--gray-300);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary-500);
    box-shadow: var(--ring-primary);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
    background: var(--gray-100);
    color: var(--text-tertiary);
    cursor: not-allowed;
}

.form-input[readonly],
.form-textarea[readonly] {
    background: var(--gray-50);
    cursor: default;
}

/* Error state */
.form-group.has-error .form-input,
.form-group.has-error .form-select,
.form-group.has-error .form-textarea {
    border-color: var(--danger-500);
}
.form-group.has-error .form-input:focus,
.form-group.has-error .form-select:focus,
.form-group.has-error .form-textarea:focus {
    box-shadow: var(--ring-danger);
}

/* Success state */
.form-group.has-success .form-input,
.form-group.has-success .form-select {
    border-color: var(--success-500);
}

/* Select with custom arrow */
.form-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
    padding-inline-end: var(--space-8);
    cursor: pointer;
}

html[dir="rtl"] .form-select {
    background-position: left var(--space-3) center;
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    cursor: pointer;
    font-size: var(--fs-sm);
    line-height: 1.4;
    padding: var(--space-1) 0;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-xs);
    background: var(--bg-surface);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    margin-top: 1px;
    transition: all var(--dur-fast) var(--ease-out);
}

.form-check input[type="radio"] {
    border-radius: 50%;
}

.form-check input[type="checkbox"]:hover,
.form-check input[type="radio"]:hover {
    border-color: var(--primary-500);
}

.form-check input[type="checkbox"]:checked,
.form-check input[type="radio"]:checked {
    background: var(--primary-600);
    border-color: var(--primary-600);
}

.form-check input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1.5px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.form-check input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    transform: translate(-50%, -50%);
}

.form-check input:focus-visible {
    box-shadow: var(--ring-primary);
}

.form-check-label {
    color: var(--text-primary);
    user-select: none;
}

/* Switch toggle */
.form-switch {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    user-select: none;
}

.form-switch input {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    width: 42px;
    height: 24px;
    background: var(--gray-300);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background var(--dur-base) var(--ease-out);
    flex-shrink: 0;
}

.form-switch input::after {
    content: '';
    position: absolute;
    top: 2px;
    inset-inline-start: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.15);
    transition: transform var(--dur-base) var(--ease-spring);
}

.form-switch input:checked {
    background: var(--primary-600);
}

.form-switch input:checked::after {
    transform: translateX(18px);
}

html[dir="rtl"] .form-switch input:checked::after {
    transform: translateX(-18px);
}

/* Input with icon */
.input-group {
    position: relative;
    display: flex;
    align-items: center;
}
.input-group .form-input {
    padding-inline-start: var(--space-10);
}
.input-group .input-icon {
    position: absolute;
    inset-inline-start: var(--space-3);
    display: grid;
    place-items: center;
    color: var(--text-muted);
    pointer-events: none;
    width: 18px;
    height: 18px;
}

.input-group .input-icon-end {
    inset-inline-start: auto;
    inset-inline-end: var(--space-3);
    pointer-events: auto;
    cursor: pointer;
}

.input-group .form-input.has-end-icon {
    padding-inline-end: var(--space-10);
}

/* Grid layout for forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

.form-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.form-grid.cols-1 {
    grid-template-columns: 1fr;
}

.form-grid .col-span-2 {
    grid-column: span 2;
}

.form-grid .col-span-3 {
    grid-column: span 3;
}

/* Form section */
.form-section {
    padding: var(--space-6);
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-5);
}

.form-section-title {
    font-size: var(--fs-h4);
    font-weight: var(--fw-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.form-section-desc {
    font-size: var(--fs-sm);
    color: var(--text-tertiary);
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-light);
}

/* Form actions */
.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-5) 0;
    margin-top: var(--space-4);
}

.form-actions.between {
    justify-content: space-between;
}

/* ============================================================
   3. CARDS
   ============================================================ */

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    transition: all var(--dur-base) var(--ease-out);
}

.card-hover:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--gray-300);
}

.card-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.card-title {
    font-size: var(--fs-h4);
    font-weight: var(--fw-bold);
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.card-subtitle {
    font-size: var(--fs-sm);
    color: var(--text-tertiary);
    margin-top: 2px;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.card-body {
    padding: var(--space-6);
}

.card-body.no-pad {
    padding: 0;
}

.card-footer {
    padding: var(--space-4) var(--space-6);
    background: var(--gray-50);
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* Stat card */
.stat-card {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    transition: all var(--dur-base) var(--ease-out);
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-500);
    opacity: 0.9;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--primary-600);
    flex-shrink: 0;
}

.stat-card .stat-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.stat-card .stat-label {
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--text-tertiary);
    line-height: 1.3;
}

.stat-card .stat-value {
    font-family: var(--font-mono);
    font-size: 26px;
    font-weight: var(--fw-bold);
    color: var(--text-primary);
    letter-spacing: var(--tracking-tight);
    line-height: 1.1;
}

.stat-card .stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    padding: 2px var(--space-2);
    border-radius: var(--radius-full);
    width: fit-content;
}
.stat-change.up {
    color: var(--success-600);
    background: var(--success-soft);
}
.stat-change.down {
    color: var(--danger-600);
    background: var(--danger-soft);
}

/* Colored variants for stat cards */
.stat-card.stat-primary::before  { background: var(--primary-500); }
.stat-card.stat-primary .stat-icon  { background: var(--primary-soft); color: var(--primary-600); }

.stat-card.stat-success::before  { background: var(--success-500); }
.stat-card.stat-success .stat-icon  { background: var(--success-soft); color: var(--success-600); }

.stat-card.stat-warning::before  { background: var(--warning-500); }
.stat-card.stat-warning .stat-icon  { background: var(--warning-soft); color: var(--warning-600); }

.stat-card.stat-danger::before   { background: var(--danger-500); }
.stat-card.stat-danger .stat-icon   { background: var(--danger-soft); color: var(--danger-600); }

.stat-card.stat-info::before     { background: var(--info-500); }
.stat-card.stat-info .stat-icon     { background: var(--info-soft); color: var(--info-600); }

.stat-card.stat-purple::before   { background: var(--purple-500); }
.stat-card.stat-purple .stat-icon   { background: var(--purple-soft); color: var(--purple-600); }

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

/* ============================================================
   4. TABLES
   ============================================================ */

.table-wrapper {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    font-size: var(--fs-sm);
    border-collapse: collapse;
}

.table thead {
    background: var(--gray-50);
    border-bottom: 1px solid var(--border);
}

.table thead th {
    padding: var(--space-3) var(--space-4);
    text-align: start;
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
}

.table thead th.sortable {
    cursor: pointer;
    transition: color var(--dur-fast);
}
.table thead th.sortable:hover {
    color: var(--primary-600);
}

.table thead th .sort-icon {
    display: inline-block;
    vertical-align: middle;
    margin-inline-start: var(--space-1);
    color: var(--text-muted);
    transition: color var(--dur-fast);
}

.table thead th.sorted {
    color: var(--primary-600);
}
.table thead th.sorted .sort-icon {
    color: var(--primary-600);
}

.table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background var(--dur-fast);
}

.table tbody tr:last-child {
    border-bottom: none;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table tbody td {
    padding: var(--space-3) var(--space-4);
    color: var(--text-secondary);
    vertical-align: middle;
    line-height: 1.5;
}

.table tbody td.strong {
    color: var(--text-primary);
    font-weight: var(--fw-medium);
}

.table .cell-num {
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    text-align: end;
    color: var(--text-primary);
    font-weight: var(--fw-medium);
}

.table .cell-actions {
    text-align: end;
    white-space: nowrap;
    width: 1%;
}

.table .cell-check {
    width: 40px;
    padding-inline: var(--space-3);
}

.table .cell-id {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--text-tertiary);
    width: 1%;
    white-space: nowrap;
}

/* Table empty state */
.table-empty {
    padding: var(--space-12) var(--space-6);
    text-align: center;
    color: var(--text-tertiary);
}

.table-empty .empty-icon {
    margin: 0 auto var(--space-4);
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-full);
    background: var(--gray-100);
    color: var(--text-muted);
}

.table-empty .empty-title {
    font-size: var(--fs-h4);
    font-weight: var(--fw-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.table-empty .empty-desc {
    font-size: var(--fs-sm);
    max-width: 420px;
    margin: 0 auto var(--space-4);
    line-height: 1.5;
}

/* Row actions menu */
.row-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.row-actions .btn-icon {
    width: 32px;
    height: 32px;
    color: var(--text-tertiary);
    border-radius: var(--radius-sm);
}
.row-actions .btn-icon:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}
.row-actions .btn-icon.danger:hover {
    background: var(--danger-soft);
    color: var(--danger-600);
}

/* Table compact */
.table.compact thead th,
.table.compact tbody td {
    padding: var(--space-2) var(--space-3);
}

/* Card-based table for mobile */
@media (max-width: 768px) {
    .table-responsive-cards thead { display: none; }
    .table-responsive-cards tbody tr {
        display: block;
        margin-bottom: var(--space-3);
        border: 1px solid var(--border-light);
        border-radius: var(--radius);
        background: var(--bg-surface);
        padding: var(--space-3);
    }
    .table-responsive-cards tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: var(--space-2) 0;
        border: none;
        border-bottom: 1px dashed var(--border-light);
        gap: var(--space-3);
    }
    .table-responsive-cards tbody td:last-child { border-bottom: none; }
    .table-responsive-cards tbody td::before {
        content: attr(data-label);
        font-weight: var(--fw-semibold);
        font-size: var(--fs-xs);
        color: var(--text-tertiary);
        text-transform: uppercase;
        letter-spacing: var(--tracking-wide);
    }
}

/* ============================================================
   5. BADGES
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    line-height: 1.4;
    letter-spacing: var(--tracking-wide);
    white-space: nowrap;
    vertical-align: middle;
}

.badge .badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* Solid */
.badge-primary  { background: var(--primary-600); color: #fff; }
.badge-success  { background: var(--success-500); color: #fff; }
.badge-warning  { background: var(--warning-500); color: #fff; }
.badge-danger   { background: var(--danger-500); color: #fff; }
.badge-info     { background: var(--info-500); color: #fff; }
.badge-gray     { background: var(--gray-500); color: #fff; }

/* Soft */
.badge-soft-primary { background: var(--primary-100); color: var(--primary-700); }
.badge-soft-success { background: var(--success-100); color: var(--success-600); }
.badge-soft-warning { background: var(--warning-100); color: var(--warning-600); }
.badge-soft-danger  { background: var(--danger-100);  color: var(--danger-600);  }
.badge-soft-info    { background: var(--info-100);    color: var(--info-600);    }
.badge-soft-gray    { background: var(--gray-100);    color: var(--gray-600);    }

/* Pulsing dot for in_progress */
.badge .badge-dot.pulse {
    animation: pulseDot 1.5s ease-in-out infinite;
    box-shadow: 0 0 0 0 currentColor;
}

@keyframes pulseDot {
    0% {
        box-shadow: 0 0 0 0 currentColor;
        opacity: 1;
    }
    70% {
        box-shadow: 0 0 0 6px transparent;
        opacity: 0.8;
    }
    100% {
        box-shadow: 0 0 0 0 transparent;
        opacity: 1;
    }
}

/* Status-specific (auto-generated by status code) */
.badge.status-pending        { background: var(--warning-100); color: var(--warning-600); }
.badge.status-confirmed      { background: var(--success-100); color: var(--success-600); }
.badge.status-cancelled      { background: var(--danger-100);  color: var(--danger-600);  }
.badge.status-completed      { background: var(--primary-100); color: var(--primary-700); }
.badge.status-upcoming       { background: var(--gray-100);    color: var(--gray-600);    }
.badge.status-in-progress    { background: var(--info-100);    color: var(--info-600);    }
.badge.status-needs-attention{ background: var(--warning-100); color: var(--warning-600); }
.badge.status-unpaid         { background: var(--danger-100);  color: var(--danger-600);  }
.badge.status-partially-paid { background: var(--warning-100); color: var(--warning-600); }
.badge.status-paid           { background: var(--success-100); color: var(--success-600); }
.badge.status-refunded       { background: var(--gray-100);    color: var(--gray-600);    }
.badge.status-available      { background: var(--success-100); color: var(--success-600); }
.badge.status-assigned       { background: var(--primary-100); color: var(--primary-700); }
.badge.status-unavailable    { background: var(--danger-100);  color: var(--danger-600);  }
.badge.status-off            { background: var(--gray-100);    color: var(--gray-600);    }
.badge.status-maintenance    { background: var(--warning-100); color: var(--warning-600); }

/* ============================================================
   6. AVATARS
   ============================================================ */

.avatar {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    color: #fff;
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
    letter-spacing: var(--tracking-tight);
    overflow: hidden;
    flex-shrink: 0;
    user-select: none;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.2);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-sm { width: 32px; height: 32px; font-size: var(--fs-xs); }
.avatar-lg { width: 56px; height: 56px; font-size: var(--fs-h3); }
.avatar-xl { width: 80px; height: 80px; font-size: var(--fs-h2); }

.avatar-group {
    display: flex;
    align-items: center;
}
.avatar-group .avatar {
    margin-inline-start: -10px;
    border: 2px solid var(--bg-surface);
    box-shadow: none;
}
.avatar-group .avatar:first-child {
    margin-inline-start: 0;
}

/* ============================================================
   7. ALERTS
   ============================================================ */

.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius);
    border: 1px solid;
    font-size: var(--fs-sm);
    line-height: 1.5;
    margin-bottom: var(--space-4);
}

.alert-icon {
    flex-shrink: 0;
    margin-top: 1px;
    width: 20px;
    height: 20px;
}

.alert-body { flex: 1; }

.alert-title {
    font-weight: var(--fw-semibold);
    margin-bottom: 2px;
}

.alert-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-xs);
    opacity: 0.6;
    transition: opacity var(--dur-fast);
}
.alert-close:hover { opacity: 1; }

.alert-success {
    background: var(--success-50);
    border-color: var(--success-100);
    color: var(--success-600);
}
.alert-error {
    background: var(--danger-50);
    border-color: var(--danger-100);
    color: var(--danger-600);
}
.alert-warning {
    background: var(--warning-50);
    border-color: var(--warning-100);
    color: var(--warning-600);
}
.alert-info {
    background: var(--info-50);
    border-color: var(--info-100);
    color: var(--info-600);
}

/* ============================================================
   8. MODALS
   ============================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    display: grid;
    place-items: center;
    padding: var(--space-4);
    animation: fadeIn var(--dur-base) var(--ease-out);
    overflow-y: auto;
}

.modal {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2xl);
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    animation: scaleIn var(--dur-base) var(--ease-spring);
    overflow: hidden;
    margin: auto;
}

.modal-sm { max-width: 400px; }
.modal-md { max-width: 560px; }
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1100px; }
.modal-full { max-width: 95vw; height: 95vh; }

.modal-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-shrink: 0;
}

.modal-title {
    font-size: var(--fs-h3);
    font-weight: var(--fw-bold);
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    font-size: 22px;
    line-height: 1;
    transition: all var(--dur-fast);
    flex-shrink: 0;
}
.modal-close:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-6);
    overflow-y: auto;
    flex: 1;
    line-height: var(--lh-relaxed);
}

.modal-body.no-pad { padding: 0; }

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-light);
    background: var(--gray-50);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.modal-footer.between {
    justify-content: space-between;
}

/* ============================================================
   9. DROPDOWN MENU
   ============================================================ */

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-start: 0;
    min-width: 200px;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all var(--dur-fast) var(--ease-out);
    z-index: var(--z-dropdown);
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu.align-end {
    inset-inline-start: auto;
    inset-inline-end: 0;
}

/* ============================================================
   10. TABS
   ============================================================ */

.tabs {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-5);
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
    padding: var(--space-3) var(--space-4);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--text-tertiary);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--dur-fast);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--primary-600);
    border-bottom-color: var(--primary-600);
}

/* Pill style tabs */
.tabs-pill {
    border-bottom: none;
    background: var(--gray-100);
    border-radius: var(--radius);
    padding: 4px;
    gap: 2px;
}
.tabs-pill .tab {
    border-bottom: none;
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3);
    margin-bottom: 0;
}
.tabs-pill .tab.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* ============================================================
   11. PAGINATION
   ============================================================ */

.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.pagination-info {
    font-size: var(--fs-sm);
    color: var(--text-tertiary);
}
.pagination-info strong {
    color: var(--text-primary);
    font-weight: var(--fw-semibold);
}

.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-item { display: flex; }

.page-link {
    min-width: 36px;
    height: 36px;
    padding: 0 var(--space-3);
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    transition: all var(--dur-fast);
    cursor: pointer;
    user-select: none;
    text-decoration: none;
}

.page-link:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.page-item.active .page-link {
    background: var(--primary-600);
    color: #fff;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.page-item.disabled .page-link {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Per page selector */
.per-page-form {
    font-size: var(--fs-sm);
}
.per-page-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-tertiary);
}
.per-page-select {
    height: 34px;
    padding: 0 var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    font-size: var(--fs-sm);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
}
.per-page-select:focus {
    border-color: var(--primary-500);
    box-shadow: var(--ring-primary);
}

/* ============================================================
   12. FILTERS BAR
   ============================================================ */

.filters-bar {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.filters-bar .filter-search {
    flex: 1;
    min-width: 200px;
}

.filters-bar .filter-item {
    min-width: 160px;
}

.filters-bar .filter-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-inline-start: auto;
}

/* Chip filters */
.filter-chips {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: var(--gray-100);
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    transition: all var(--dur-fast);
    cursor: pointer;
    border: 1px solid transparent;
    user-select: none;
}

.chip:hover {
    background: var(--gray-200);
}

.chip.active {
    background: var(--primary-600);
    color: #fff;
}

.chip.chip-removable {
    padding-inline-end: var(--space-2);
}
.chip .chip-remove {
    width: 16px;
    height: 16px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    font-size: 12px;
    line-height: 1;
    transition: background var(--dur-fast);
    cursor: pointer;
}
.chip .chip-remove:hover {
    background: rgba(255, 255, 255, 0.35);
}
.chip:not(.active) .chip-remove {
    background: rgba(0, 0, 0, 0.08);
}
.chip:not(.active) .chip-remove:hover {
    background: rgba(0, 0, 0, 0.15);
}

/* ============================================================
   13. PROGRESS BARS
   ============================================================ */

.progress {
    width: 100%;
    height: 6px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: var(--primary-600);
    border-radius: var(--radius-full);
    transition: width var(--dur-slow) var(--ease-out);
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmerProgress 1.5s infinite;
}

@keyframes shimmerProgress {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}

.progress-sm { height: 4px; }
.progress-lg { height: 10px; }

.progress-bar.bg-success { background: var(--success-500); }
.progress-bar.bg-warning { background: var(--warning-500); }
.progress-bar.bg-danger  { background: var(--danger-500); }
.progress-bar.bg-info    { background: var(--info-500); }

/* ============================================================
   14. TOOLTIPS
   ============================================================ */

[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--gray-900);
    color: #fff;
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--dur-fast), transform var(--dur-fast);
    z-index: var(--z-dropdown);
    box-shadow: var(--shadow-md);
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================================
   15. EMPTY STATES
   ============================================================ */

.empty-state {
    padding: var(--space-12) var(--space-6);
    text-align: center;
    max-width: 480px;
    margin: 0 auto;
}

.empty-state-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto var(--space-5);
    display: grid;
    place-items: center;
    border-radius: var(--radius-full);
    background: var(--gray-100);
    color: var(--text-muted);
}

.empty-state-title {
    font-size: var(--fs-h3);
    font-weight: var(--fw-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.empty-state-desc {
    font-size: var(--fs-sm);
    color: var(--text-tertiary);
    line-height: 1.6;
    margin-bottom: var(--space-5);
}

.empty-state-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================================
   16. TIMELINE
   ============================================================ */

.timeline {
    position: relative;
    padding-inline-start: var(--space-8);
}

.timeline::before {
    content: '';
    position: absolute;
    top: 8px;
    bottom: 8px;
    inset-inline-start: 11px;
    width: 2px;
    background: var(--border-light);
    border-radius: var(--radius-full);
}

.timeline-item {
    position: relative;
    padding-bottom: var(--space-5);
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
    position: absolute;
    inset-inline-start: calc(-1 * var(--space-8) + 4px);
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 2px solid var(--primary-600);
    box-shadow: 0 0 0 4px var(--bg-surface);
}

.timeline-dot.success { border-color: var(--success-500); }
.timeline-dot.warning { border-color: var(--warning-500); }
.timeline-dot.danger  { border-color: var(--danger-500); }

.timeline-time {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-bottom: 2px;
    font-family: var(--font-mono);
}

.timeline-title {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--text-primary);
    margin-bottom: 2px;
    line-height: 1.4;
}

.timeline-desc {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ============================================================
   17. PAGE HEADER
   ============================================================ */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

.page-header-info {
    flex: 1;
    min-width: 0;
}

.page-header-title {
    font-size: var(--fs-h1);
    font-weight: var(--fw-bold);
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: var(--tracking-tight);
    margin: 0 0 var(--space-2) 0;
}

.page-header-desc {
    font-size: var(--fs-sm);
    color: var(--text-tertiary);
    line-height: 1.5;
    max-width: 640px;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ============================================================
   18. DETAIL LIST (dl-style)
   ============================================================ */

.detail-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.detail-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px dashed var(--border-light);
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--text-tertiary);
    min-width: 140px;
    flex-shrink: 0;
}

.detail-value {
    font-size: var(--fs-sm);
    color: var(--text-primary);
    font-weight: var(--fw-medium);
    flex: 1;
    word-break: break-word;
}

.detail-value.muted {
    color: var(--text-tertiary);
    font-weight: var(--fw-regular);
}

/* Two-column version */
.detail-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-3) var(--space-6);
}

/* ============================================================
   19. LOADING SKELETON
   ============================================================ */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--gray-100) 0%,
        var(--gray-200) 50%,
        var(--gray-100) 100%
    );
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeletonShimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

.skeleton-text {
    height: 14px;
    margin-bottom: var(--space-2);
    width: 100%;
}
.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 70%; }

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
}

.skeleton-card {
    height: 120px;
    border-radius: var(--radius-lg);
}

/* ============================================================
   20. TAGS
   ============================================================ */

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--gray-100);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    line-height: 1.5;
    white-space: nowrap;
}

.tag-primary { background: var(--primary-100); color: var(--primary-700); }
.tag-success { background: var(--success-100); color: var(--success-600); }
.tag-warning { background: var(--warning-100); color: var(--warning-600); }
.tag-danger  { background: var(--danger-100);  color: var(--danger-600);  }
.tag-info    { background: var(--info-100);    color: var(--info-600);    }

/* ============================================================
   21. SEPARATORS
   ============================================================ */

.divider {
    height: 1px;
    background: var(--border-light);
    margin: var(--space-5) 0;
    border: none;
}

.divider-vertical {
    width: 1px;
    height: 24px;
    background: var(--border-light);
    margin: 0 var(--space-3);
    display: inline-block;
    vertical-align: middle;
}

/* ============================================================
   22. SEARCH HIGHLIGHT
   ============================================================ */

mark.highlight {
    background: var(--warning-100);
    color: var(--warning-700, #92400e);
    padding: 0 3px;
    border-radius: 3px;
    font-weight: var(--fw-semibold);
}

/* ============================================================
   23. RESPONSIVE ADJUSTMENTS
   ============================================================ */

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    .page-header-actions {
        width: 100%;
    }
    .page-header-actions .btn {
        flex: 1;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-grid.cols-3 {
        grid-template-columns: 1fr;
    }
    .form-grid .col-span-2,
    .form-grid .col-span-3 {
        grid-column: span 1;
    }

    .form-actions {
        flex-direction: column-reverse;
    }
    .form-actions .btn {
        width: 100%;
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .filters-bar .filter-actions {
        margin-inline-start: 0;
        width: 100%;
    }
    .filters-bar .filter-actions .btn {
        flex: 1;
    }

    .pagination-wrapper {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .detail-item {
        flex-direction: column;
        gap: var(--space-1);
    }
    .detail-label {
        min-width: 0;
    }

    .modal-footer {
        flex-direction: column-reverse;
    }
    .modal-footer .btn {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .btn { padding: 0 var(--space-3); }
    .btn-lg { padding: 0 var(--space-4); }
    .card-body { padding: var(--space-4); }
    .card-header { padding: var(--space-4); }
    .modal-body { padding: var(--space-4); }
    .modal-header { padding: var(--space-4); }
    .form-section { padding: var(--space-4); }
}

/* ============================================================
   END OF components.css
   ============================================================ */