/* ═════════════════════════════════════════════════════════════════════
   YachtClean Standardized UI Component Library (UIComponents CSS)
   Identidad Náutica Corporativa · Paleta Oficial Slate / Teal / Emerald
   ═════════════════════════════════════════════════════════════════════ */

/* ─── 1. UI.BottomSheet ─── */
.ui-bottom-sheet-backdrop,
.agenda-bottom-sheet-backdrop,
.yrm-bottom-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99990;
    opacity: 0;
    visibility: hidden;
    display: none;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.ui-bottom-sheet-backdrop.active,
.agenda-bottom-sheet-backdrop.active,
.yrm-bottom-sheet-backdrop.active {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    pointer-events: auto !important;
}

@media (min-width: 769px) {
    #agenda-bs-backdrop,
    .agenda-bottom-sheet-backdrop,
    .agenda-bottom-sheet-backdrop.active,
    #yrm-bs-backdrop,
    .yrm-bottom-sheet-backdrop,
    .yrm-bottom-sheet-backdrop.active {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
}

.ui-bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 99995;
    background: #ffffff;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.22);
    padding: 14px 16px 36px 16px;
    transform: translateY(105%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    margin: 0;
    box-sizing: border-box;
}

.ui-bottom-sheet.open {
    transform: translateY(0);
}

.ui-bottom-sheet-drag-handle {
    width: 42px;
    height: 5px;
    background: #cbd5e1;
    border-radius: 10px;
    margin: 0 auto 12px auto;
    display: block;
}

/* ─── 2. UI.Modal ─── */
.ui-modal-overlay,
.modal-overlay,
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2147483647 !important;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    box-sizing: border-box;
}

.ui-modal-overlay.active,
.ui-modal-overlay.open,
.modal-overlay.active,
.modal-overlay.open,
.modal-backdrop.active,
.modal-backdrop.open {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.ui-modal-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.35);
    display: flex;
    flex-direction: column;
    color: #0f172a;
    overflow: hidden;
    box-sizing: border-box;
    transform: scale(0.96);
    transition: transform 0.25s ease;
}

.ui-modal-overlay.active .ui-modal-card,
.modal-backdrop.active .modal-card {
    transform: scale(1);
}

.ui-modal-header {
    background: #0f172a;
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #1e293b;
    flex-shrink: 0;
}

.ui-modal-title {
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
    margin: 0;
}

.ui-modal-close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color 0.15s ease;
}

.ui-modal-close-btn:hover {
    color: #ffffff;
}

.ui-modal-body {
    padding: 18px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    box-sizing: border-box;
}

.ui-modal-footer {
    padding: 14px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

/* ─── 3. UI.ToggleSwitch ─── */
.ui-toggle-wrapper {
    background: #f8fafc;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: opacity 0.2s ease;
}

.ui-toggle-wrapper.disabled {
    pointer-events: none;
    opacity: 0.65;
}

.ui-toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    cursor: pointer;
    flex-shrink: 0;
}

.ui-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ui-toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: background-color 0.3s ease;
    border-radius: 26px;
}

.ui-toggle-slider::before {
    position: absolute;
    content: '';
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: transform 0.3s ease;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ui-toggle-switch input:checked + .ui-toggle-slider {
    background-color: #059669;
}

.ui-toggle-switch input:checked + .ui-toggle-slider::before {
    transform: translateX(21px);
}

/* ─── 4. UI.Badge ─── */
.ui-badge {
    font-weight: 800;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ui-badge.status-ok,
.ui-badge.status-activo {
    background: #ecfdf5;
    color: #059669;
}

.ui-badge.status-warn,
.ui-badge.status-alerta {
    background: #fffbeb;
    color: #d97706;
}

.ui-badge.status-crit,
.ui-badge.status-critico {
    background: #fef2f2;
    color: #dc2626;
}

.ui-badge.status-inactive,
.ui-badge.status-inactivo {
    background: #f8fafc;
    color: #64748b;
}

/* ─── 5. UI.AccordionCard ─── */
.ui-accordion-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.ui-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    user-select: none;
}

.ui-accordion-body {
    padding: 10px 12px;
    border-top: 1px dashed #cbd5e1;
    background: #ffffff;
}
