/**
 * Taboada Design System - UI Components
 */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@800;900&display=swap');

/* --- Cards --- */
.ui-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--trans-fast);
}

.ui-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.ui-card-body {
    padding: 1.5rem;
}

.ui-stat-card {
    padding: 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

.stat-value {
    font-family: 'Montserrat', sans-serif;
    font-size: 2.2rem;
    font-weight: 900;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Navigation Tabs (Modern Style) --- */
.ui-tabs {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding: 0 1rem;
}

.ui-tab {
    padding: 1rem 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    transition: var(--trans-fast);
    position: relative;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
}

.ui-tab:hover {
    color: var(--text-main);
}

.ui-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.ui-tab-badge {
    margin-left: 8px;
    background: var(--surface-header);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.ui-tab.active .ui-tab-badge {
    background: var(--primary);
    color: #fff;
}

/* --- Page Header --- */
/* --- Page Header (Governance 5.1 Standard) --- */
.page-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    width: 100%;
}

.page-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.65rem;
    font-weight: 900;
    color: var(--text-main);
    margin: 0;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 2px;
    font-weight: 500;
}

/* --- Buttons --- */
.ui-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.88rem;
    transition: var(--trans-fast);
    border: none !important;
    outline: none !important;
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
    box-shadow: none !important;
}

.ui-btn-primary {
    background-color: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-primary);
}

.ui-btn-primary:hover {
    background-color: var(--primary-dark);
    transform: scale(1.02);
}

.ui-btn-secondary {
    background-color: rgba(0, 0, 0, 0.05) !important;
    color: var(--text-main) !important;
}

.ui-btn-secondary:hover {
    background-color: rgba(0, 0, 0, 0.1) !important;
}

/* Button Sizing Variants */
.ui-btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
    height: 32px;
}

.ui-btn-xs {
    padding: 4px 8px;
    font-size: 0.7rem;
    height: 28px;
}


/* --- Modern Table Actions --- */
.action-group-tight {
    display: flex;
    gap: 4px;
    justify-content: center;
    align-items: center;
}

.action-btn-flat {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--text-muted);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    border: none !important;
    background: transparent;
}

.action-btn-flat:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.action-btn-flat.btn-wa { color: #22c55e !important; }
.action-btn-flat.btn-edit { color: var(--primary) !important; }
.action-btn-flat.btn-danger {
    background: var(--danger);
    color: #fff !important;
}
.action-btn-flat.btn-edit:hover, .action-btn-flat.text-primary:hover { color: var(--primary) !important; background: rgba(0, 166, 229, 0.08); }
.action-btn-flat.btn-promo:hover { color: #f59e0b !important; background: rgba(245, 158, 11, 0.08); }
.action-btn-flat.btn-pause:hover, .action-btn-flat.text-warning:hover { color: var(--warning) !important; background: rgba(245, 158, 11, 0.08); }
.action-btn-flat.btn-play:hover, .action-btn-flat.text-success:hover { color: var(--success) !important; background: rgba(16, 185, 129, 0.08); }
.action-btn-flat.btn-danger:hover {
    color: #fff !important;
    background: #dc2626;
}
.action-btn-flat.btn-archive:hover, .action-btn-flat.text-danger:hover { color: var(--danger) !important; background: rgba(239, 68, 68, 0.08); }
.action-btn-flat.btn-print:hover { color: var(--text-muted) !important; background: rgba(0, 0, 0, 0.05); }

/* Typography Utilities */
.text-bold { font-weight: 700 !important; }
.text-semibold { font-weight: 600 !important; }
.text-500 { font-weight: 500 !important; }
.fw-bold { font-weight: 700 !important; }
.text-uppercase { text-transform: uppercase !important; }
.text-decoration-none { text-decoration: none !important; }
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-info { color: var(--info) !important; }
.text-no-underline { text-decoration: none !important; }

.cell-code-link {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

.cell-code-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.flex-center-gap {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* High Density Table Utilities */
.cell-1line {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-1line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-1line-wrap {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.text-xs-muted {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.h-full { height: 100%; }

/* Atomic Utilities (Governance 5.1) */
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.d-block { display: block !important; }
.flex-column { flex-direction: column !important; }
.align-items-center { align-items: center !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-end { justify-content: flex-end !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-grow-1 { flex-grow: 1 !important; }
.gap-1 { gap: 4px !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 12px !important; }
.gap-4 { gap: 16px !important; }
.gap-5 { gap: 20px !important; }
.gap-15 { gap: 15px !important; }
.flex-1 { flex: 1 !important; }
.text-nowrap { white-space: nowrap !important; }
.badge-help-indicator { width:80px; justify-content:center; padding: 2px 6px; pointer-events:none; }
.help-legend-row { display: flex; align-items: center; gap: 8px; }

.w-32 { width: 32px !important; }
.w-38 { width: 38px !important; }
.w-80 { width: 80px !important; }
.w-100 { width: 100% !important; }
.w-180 { width: 180px !important; }
.w-250 { width: 250px !important; }
.max-w-400 { max-width: 400px !important; }
.h-28 { height: 28px !important; }
.h-32 { height: 32px !important; }
.h-34 { height: 34px !important; }
.h-38 { height: 38px !important; }
.h-80 { height: 80px !important; }

.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.top-50 { top: 50% !important; }
.start-0 { left: 0 !important; }
.translate-middle-y { transform: translateY(-50%) !important; }

.me-1 { margin-right: 4px !important; }
.me-2 { margin-right: 8px !important; }
.ms-1 { margin-left: 4px !important; }
.ms-2 { margin-left: 8px !important; }
.ms-3 { margin-left: 12px !important; }
.mt-1 { margin-top: 4px !important; }
.mt-2 { margin-top: 8px !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 4px !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 12px !important; }
.mx-auto { margin-left: auto !important; margin-right: auto !important; }

.p-0 { padding: 0 !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.25rem !important; }
.p-5 { padding: 3rem !important; }
.p-6 { padding: 1.5rem !important; }
.p-8 { padding: 2rem !important; }
.px-2 { padding-left: 8px !important; padding-right: 8px !important; }
.px-3 { padding-left: 1rem !important; padding-right: 1rem !important; }
.px-4 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
.ps-3 { padding-left: 1rem !important; }
.ps-5 { padding-left: 2rem !important; }
.pe-3 { padding-right: 1rem !important; }
.py-1 { padding-top: 4px !important; padding-bottom: 4px !important; }
.py-2 { padding-top: 8px !important; padding-bottom: 8px !important; }
.pb-2 { padding-bottom: 8px !important; }

.fs-xxs { font-size: 0.65rem !important; }
.fs-xs { font-size: 0.72rem !important; }
.fs-sm { font-size: 0.85rem !important; }
.fs-md { font-size: 0.95rem !important; }
.fs-lg { font-size: 1.25rem !important; }
.fs-1 { font-size: 2.5rem !important; }
.fs-7 { font-size: 0.7rem !important; }
.fs-75 { font-size: 0.75rem !important; }
.fs-8 { font-size: 0.8rem !important; }
.fs-9 { font-size: 0.9rem !important; }
.fs-11 { font-size: 1.1rem !important; }
.text-end { text-align: right !important; }
.text-center { text-align: center !important; }
.opacity-75 { opacity: 0.75 !important; }

/* Background Subtles */
.bg-primary-subtle { background: rgba(0, 166, 229, 0.1) !important; }
.bg-success-subtle { background: rgba(16, 185, 129, 0.1) !important; }
.bg-warning-subtle { background: rgba(245, 158, 11, 0.1) !important; }
.bg-danger-subtle { background: rgba(239, 68, 68, 0.1) !important; }
.bg-light-subtle { background: rgba(0, 0, 0, 0.03) !important; }
.bg-white { background: #fff !important; }
:root.theme-dark .bg-light-subtle { background: rgba(255, 255, 255, 0.03) !important; }
:root.theme-dark .bg-white { background: var(--bg-card) !important; }

/* Borders */
.border-none { border: none !important; }
.border-top { border-top: 1px solid var(--border-color) !important; }
.border-top-primary-4 { border-top: 4px solid var(--primary) !important; }
.border-bottom { border-bottom: 1px solid var(--border-color) !important; }

.border-top-none { border-top: none !important; }
.rounded { border-radius: var(--radius-md) !important; }
.rounded-circle { border-radius: 50% !important; }
.rounded-top-none { border-top-left-radius: 0 !important; border-top-right-radius: 0 !important; }

/* --- Badges --- */
.ui-badge {
    display: inline-flex;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.badge-info { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-primary { background: rgba(0, 166, 229, 0.15); color: var(--primary); }

/* --- High-Density Operational Tables --- */
.list-view-desktop table,
.data-table,
.ui-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem !important; /* STRICT Uniform Font Size */
}

/* Responsive Table Support */
@media (max-width: 768px) {
    .data-table, .ui-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-bottom: 1px solid var(--border-color);
    }
}

.list-view-desktop td,
.data-table td,
.ui-table td {
    padding: 0.65rem 1rem !important; /* Standardized Row Height */
    vertical-align: middle;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
}

.list-view-desktop th,
.data-table th,
.ui-table th {
    padding: 0.75rem 1rem !important;
    background: rgba(0, 0, 0, 0.02);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 2px solid var(--border-color);
}

.table-compact th { padding: 0.5rem 0.75rem !important; }
.table-compact td { padding: 0.4rem 0.75rem !important; }

.table-ultra-compact th { padding: 0.42rem 0.58rem !important; }
.table-ultra-compact td { padding: 0.34rem 0.58rem !important; }

.badge-nowrap {
    white-space: nowrap !important;
    flex-wrap: nowrap !important;
}

.table-shell {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table-shell .data-table { table-layout: fixed; }

.table-shell .table-container {
    border: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

.table-zebra tr:nth-child(even) td {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-zebra tr:hover td {
    background-color: rgba(0, 0, 0, 0.05) !important;
}

:root.theme-dark .table-zebra tr:hover td {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* --- Forms & Inputs --- */
.ui-input {
    width: 100%;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    color: var(--text-main);
    font-size: 0.9rem;
    transition: var(--trans-fast);
}

.ui-input-sm {
    padding: 6px 10px;
    font-size: 0.85rem;
}

.ui-input-xs {
    padding: 4px 8px;
    font-size: 0.75rem;
}

.ui-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Governance Utilities: Core List Screens --- */
.ui-card-compact { margin-bottom: 1rem; }
.ui-card-compact .ui-card-body { padding: 0.75rem; }

.toolbar-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.toolbar-field {
    flex: 1;
    position: relative;
}

.toolbar-field-2x { flex: 2; }

.toolbar-actions {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.toolbar-actions .ui-btn {
    height: 38px;
}

.input-icon-wrap { position: relative; }

.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    color: var(--text-muted);
}

.input-with-icon {
    padding-left: 38px;
    height: 38px;
    font-size: 0.9rem;
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
}

.btn-compact {
    height: 38px;
    padding: 0 20px;
    font-size: 0.8rem;
}

.btn-icon-square {
    height: 38px;
    width: 38px;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.section-kicker {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0.75rem;
}

.section-kicker h2 {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.compact-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    padding: 0;
    min-width: 0;
}

.pager-compact {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pager-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.75rem;
}

.pager-pill {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.05);
    padding: 0 10px;
    height: 28px;
    display: flex;
    align-items: center;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

/* --- Platform Icons --- */
.platform-links-tight {
    display: flex;
    gap: 6px;
    align-items: center;
}

.platform-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    padding: 2px;
}

.platform-icon-btn:hover { 
    transform: translateY(-2px); 
    background: var(--bg-card);
}

/* --- Accessibility & Theme Controls --- */
.ui-control-group {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(0, 0, 0, 0.06);
    padding: 3px;
    border-radius: 8px;
    border: none !important;
}

.ui-scale-btn, .ui-theme-btn {
    border: none !important;
    background: transparent;
    color: var(--text-muted);
    font-weight: 800;
    padding: 0 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--trans-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 30px;
    font-size: 0.85rem;
}

.ui-scale-btn:hover, .ui-theme-btn:hover {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
}

.ui-scale-btn.active, .ui-theme-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* --- Theme Toggle Specific --- */
.theme-toggle-container {
    display: flex;
    gap: 4px;
}

/* --- Dashboard Components --- */
.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 1.25rem 0.5rem;
    background: rgba(0,0,0,0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    transition: var(--trans-fast);
    text-align: center;
}
.quick-action-btn:hover { background: var(--bg-card); border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.quick-action-btn i { width: 28px; height: 28px; }
.quick-action-btn span { font-size: 0.7rem; font-weight: 900; color: var(--text-main); text-transform: uppercase; letter-spacing: 0.05em; }

.metric-card { transition: var(--trans-fast); }
.metric-card:hover { transform: translateY(-3px); box-shadow: 0 8px 15px rgba(0,0,0,0.08); }
.metric-card .metric-label { font-size: 0.72rem; font-weight: 900; text-transform: uppercase; margin-bottom: 4px; color: var(--text-muted); letter-spacing: 0.05em; }
.metric-card .metric-value { font-size: 2.8rem; font-weight: 900; line-height: 1; }
.metric-card .metric-link { font-weight: 800; text-decoration: none; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; display: inline-block; }

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: rgba(0,0,0,0.02);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    transition: var(--trans-fast);
}
.task-item:hover { background: var(--bg-card); transform: translateX(4px); }

.task-check-btn {
    padding: 0;
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--trans-fast);
}
.task-check-btn:hover { background: var(--success); border-color: var(--success); }
.task-check-btn:hover i { color: white; }
.task-check-btn i { width: 14px; height: 14px; color: var(--text-muted); }

.stat-box { background: rgba(0,0,0,0.02); padding: 1.25rem; border-radius: 8px; text-align: center; border: 1px solid var(--border-color); }

.alert-banner { border-left-width: 5px; border-left-style: solid; }

.cursor-pointer { cursor: pointer !important; }

/* --- Amenity Chips --- */
.amenity-chip {
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    line-height: 1.1;
}
.amenity-chip:hover {
    border-color: var(--primary);
    background: rgba(0, 166, 229, 0.02);
}
.amenity-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}
.amenity-chip input { display: none; }

/* --- Info Pill --- */
.info-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 7px;
    background: rgba(0, 166, 229, 0.03);
    border-radius: 4px;
    font-size: 0.68rem;
    color: var(--text-main);
    font-weight: 500;
    border: 1px solid rgba(0, 166, 229, 0.05);
}
.info-pill i { width: 14px; height: 14px; color: var(--primary); opacity: 0.7; }
.info-pill strong { font-weight: 800; color: var(--primary); }

/* --- Timeline Component --- */
.timeline-container { position: relative; }
.timeline-container::before { content:'';position:absolute;left:19px;top:0;bottom:0;width:2px;background:var(--border-color); }
.timeline-item { position:relative;padding-left:55px;padding-bottom:30px;display:flex;align-items:flex-start;justify-content:space-between;gap:15px; }
.timeline-icon { position:absolute;left:0;width:40px;height:40px;background:var(--bg-card);border:2px solid var(--border-color);border-radius:50%;display:flex;align-items:center;justify-content:center;z-index:1;color:var(--primary); }
.timeline-content { flex:1;background:var(--bg-main);padding:15px;border-radius:12px;border:1px solid var(--border-color); }
.timeline-header { display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid var(--border-color);padding-bottom:8px;margin-bottom:8px; }

/* --- Match Item --- */
.match-item { background:var(--bg-main);border:1px solid var(--border-color);border-radius:12px;padding:10px 15px;display:flex;align-items:center;justify-content:space-between;transition:0.2s; }
.match-item:hover { border-color:var(--primary);transform:translateX(5px); }

/* --- WhatsApp Button --- */
.ui-btn-whatsapp { background:#25d366!important;color:white!important;border-color:#25d366!important; }
.ui-btn-whatsapp:hover { background:#128c7e!important; }

/* --- Spinner Animation --- */
.spin { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* --- Print Utility --- */
.only-print { display: none !important; }

/* --- Diff Highlighting --- */
.diff-changed { background-color: #fef3c7 !important; border-color: #fde68a !important; }
.diff-new { background-color: #d1fae5 !important; border-color: #a7f3d0 !important; }

/* --- Mobile Search Overlay (base hidden state) --- */
.mobile-search-overlay { display: none; }

/* --- RESPONSIVE GOVERNANCE 1.0 --- */

@media (max-width: 768px) {
    /* 1. Page Header Stacking */
    .page-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
        margin-bottom: 1.5rem !important;
    }

    .page-title {
        font-size: 1.5rem !important;
        text-align: center;
    }

    .page-subtitle {
        text-align: center;
        margin-bottom: 0.5rem;
    }

    .action-group {
        flex-direction: column !important;
        width: 100% !important;
        gap: 8px !important;
    }

    .action-group .ui-btn {
        width: 100% !important;
        height: 44px !important; /* Touch friendly */
        justify-content: center !important;
        font-size: 0.9rem !important;
    }

    /* 2. Filters & Toolbars */
    .ui-toolbar-form > div {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .ui-toolbar-form .ui-btn {
        width: 100% !important;
        height: 40px !important;
    }

    /* 3. Grid Stacking */
    .grid-12 {
        gap: 15px !important;
    }
    
    .span-1, .span-2, .span-3, .span-4, .span-5, .span-6, 
    .span-7, .span-8, .span-9, .span-10, .span-11 {
        grid-column: span 12 !important;
    }

    /* 4. Table to Card Transformation */
    .list-view-desktop {
        display: none !important;
    }

    .list-view-mobile {
        display: block !important;
    }

    .data-card {
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 1rem;
        margin-bottom: 1rem;
        box-shadow: var(--shadow-sm);
        overflow: hidden;
        word-wrap: break-word;
        max-width: 100%;
    }

    .card-title {
        display: flex;
        justify-content: space-between;
        align-items: start;
        color: var(--primary);
        margin-bottom: 0.75rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid var(--border-color);
        word-break: break-word;
        overflow: hidden;
    }

    .card-title-main {
        flex: 1;
        min-width: 0;
        font-weight: 800;
        font-size: 1.05rem;
    }

    .card-title-badge {
        font-size: 0.7rem;
        font-weight: 700;
        color: var(--primary);
        background: var(--bg-main);
        padding: 2px 8px;
        border-radius: 6px;
        border: 1px solid var(--border-color);
        white-space: nowrap;
        margin-left: 0.5rem;
    }

    .card-row {
        display: flex;
        justify-content: space-between;
        padding: 0.4rem 0;
        font-size: 0.85rem;
        border-bottom: 1px dashed var(--border-color);
    }

    .card-row:last-of-type {
        border-bottom: none;
    }

    .card-label {
        color: var(--text-muted);
        font-weight: 700;
        text-transform: uppercase;
        font-size: 0.7rem;
        letter-spacing: 0.02em;
        padding-right: 0.5rem;
        flex-shrink: 0;
    }

    .card-value {
        color: var(--text-main);
        font-weight: 600;
        text-align: right;
        flex: 1;
        min-width: 0;
        word-break: break-word;
    }

    .card-actions {
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px dashed var(--border-color);
        display: flex !important;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }

    .card-actions .ui-btn {
        flex: 1;
        min-width: 100px;
        justify-content: center;
    }

    /* 4. Topbar Adjustments */
    .topbar-search {
        display: none !important; /* Will be replaced by lupa icon logic if implemented */
    }
    
    .breadcrumb {
        display: block !important;
        margin-bottom: 1rem;
    }
    
    .back-link {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        color: var(--text-muted);
        text-decoration: none;
        font-weight: 700;
        font-size: 0.85rem;
        text-transform: uppercase;
    }

    #mobileSearchToggle {
        display: flex !important;
    }

    .mobile-search-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background: var(--bg-card);
        z-index: 2000;
        display: none;
        align-items: center;
        padding: 0 1rem;
        box-shadow: var(--shadow-md);
        border-bottom: 2px solid var(--primary);
    }

    .mobile-search-overlay.active {
        display: flex;
    }
}

@media (min-width: 769px) {
    .list-view-mobile {
        display: none !important;
    }
}

/* --- Audit / Toolbar (shared) --- */
.audit-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.audit-toolbar-main {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex: 1;
}

.audit-filter-field {
    width: 250px;
}

.audit-bulk-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 166, 229, 0.05);
    border: 1px dashed var(--primary);
    border-radius: 6px;
    padding: 4px 10px;
}

.audit-bulk-count {
    font-size: 0.74rem;
    font-weight: 800;
    color: var(--primary);
    white-space: nowrap;
}

.audit-toolbar-note {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.audit-state-badge {
    display: inline-flex;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    justify-content: center;
    font-size: 0.64rem;
    letter-spacing: 0;
    padding: 4px 6px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-sync-photos {
    width: 20px;
    height: 20px;
    padding: 0;
    flex: 0 0 auto;
}

.btn-sync-photos.sync-success {
    color: var(--success) !important;
}

.spin {
    animation: fa-spin 1s linear infinite;
}

@keyframes fa-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#audit-table {
    table-layout: fixed;
}

@media (max-width: 900px) {
    .audit-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .audit-toolbar-main {
        flex-direction: column;
        align-items: stretch;
    }
    .audit-filter-field {
        width: 100%;
    }
    .audit-toolbar-note {
        white-space: normal;
    }
}

/* --- Availability Card Span (disponibilidad) --- */
@media (max-width: 1200px) { .availability-card-span { grid-column: span 4; } }
@media (max-width: 900px) { .availability-card-span { grid-column: span 6; } }
@media (max-width: 640px) { .availability-card-span { grid-column: span 12; } }

/* --- Responsive action-group (crm_detalle) --- */
@media (max-width: 991px) { .action-group, .timeline-header, .match-item { flex-direction:column;align-items:stretch; } }

/* --- Utility: hidden --- */
.hidden { display: none !important; }

/* --- Modal System (crm_prospectos) --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(8px);
}
.modal-content {
    background: var(--bg-card); width: 95%; max-width: 650px;
    border-radius: 20px; box-shadow: var(--shadow-lg); overflow: hidden;
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid var(--border-color);
}
@keyframes modalIn {
    from { transform: scale(0.9) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-header {
    padding: 24px 30px; border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
    background: var(--bg-card);
}
.modal-header h2 { margin: 0; font-size: 1.25rem; font-weight: 900; color: var(--text-main); letter-spacing: -0.025em; }
.close-btn {
    background: var(--border-color); border: none; width: 32px; height: 32px;
    border-radius: 50%; font-size: 1.2rem; color: var(--text-muted);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.close-btn:hover { background: var(--border-hover); color: var(--text-main); }
.modal-body { padding: 30px; max-height: 80vh; overflow-y: auto; }
.modal-footer {
    padding: 20px 30px; border-top: 1px solid var(--border-color);
    text-align: right; background: var(--bg-card);
}

/* --- Detail Grid (crm_prospectos) --- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.detail-item label {
    display: block; font-size: 0.65rem; color: var(--text-muted);
    text-transform: uppercase; font-weight: 800; margin-bottom: 6px; letter-spacing: 0.05em;
}
.detail-item span { font-weight: 700; color: var(--text-main); font-size: 0.95rem; line-height: 1.4; }
.full-width { grid-column: span 2; }

/* --- Contact Styles (crm_prospectos) --- */
.contact-entry {
    background: var(--surface-header); padding: 10px 15px; border-radius: 10px;
    border: 1px solid var(--border-color); margin-bottom: 8px;
    display: flex; align-items: center; gap: 10px;
}
.contact-entry strong { font-size: 0.9rem; color: var(--text-main); }
.wa-link {
    background: #25D366; color: #fff !important; padding: 4px 10px; border-radius: 6px;
    font-size: 0.7rem; font-weight: 800; text-decoration: none;
    display: flex; align-items: center; gap: 5px; margin-left: auto; transition: opacity 0.2s;
}
.wa-link:hover { opacity: 0.9; }

/* --- Role Badges (crm_prospectos) --- */
.role-badge {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
    border-radius: 8px; font-weight: 800; font-size: 0.75rem;
    margin: 4px 8px 4px 0; text-transform: uppercase;
}
.role-vendedor { background: var(--danger); color: #991b1b; }
.role-comprador { background: #dcfce7; color: #166534; }

/* --- Info Lines (crm_prospectos) --- */
.info-line {
    background: var(--surface-header); padding: 8px 12px; border-radius: 8px;
    margin-bottom: 6px; font-size: 0.85rem; color: var(--text-main); font-weight: 600;
}
.context-box {
    background: #fffbeb; border: 1px solid #fef3c7; padding: 12px;
    border-radius: 10px; color: #92400e; font-size: 0.8rem; margin-top: 10px;
}
.context-box strong {
    color: #b45309; text-transform: uppercase; font-size: 0.65rem; display: block; margin-bottom: 4px;
}
