/* === CITYCELL PREMIUM MODAL SYSTEM (SENIOR ARCHITECTURE) === */

:root {
    --modal-overlay: rgba(15, 23, 42, 0.7);
    --modal-blur: 8px;
    --modal-radius: 24px;
    --modal-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --modal-z: 10000;
}

/* Base Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--modal-overlay);
    -webkit-backdrop-filter: blur(var(--modal-blur));
    backdrop-filter: blur(var(--modal-blur));
    z-index: var(--modal-z);
    display: flex;
    align-items: flex-start; 
    justify-content: center;
    padding: 60px 20px; /* Mas espacio arriba */
    overflow-y: auto;
    opacity: 0; 
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Modal Content Container */
.modal-content {
    background: white;
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    border-radius: var(--modal-radius);
    box-shadow: var(--modal-shadow);
    display: flex;
    flex-direction: column;
    position: relative;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}

/* Header */
.modal-header {
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid transparent;
    /* Removed harsh border */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-close {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
    background: #f8fafc;
}

.modal-close:hover {
    background: #fee2e2;
    color: #ef4444;
    transform: rotate(90deg);
}

/* Body (Scrollable) */
.modal-body {
    padding: 0 var(--space-xl) var(--space-xl) var(--space-xl);
    overflow-y: auto;
    flex: 1;
}

/* Footer (Sticky) */
.modal-footer {
    padding: var(--space-lg) var(--space-xl);
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    background: #fcfcfc;
    border-bottom-left-radius: var(--modal-radius);
    border-bottom-right-radius: var(--modal-radius);
}

/* Extra Large Variant */
.modal-xl,
.modal-xl-premium {
    max-width: 1000px;
}

/* Small Variant */
.modal-sm {
    max-width: 400px;
}

/* Adaptive / Flexible Modal Container (Used in POS) */
.modal-adaptive-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 500px;
    max-height: 90vh;
}

.modal-adaptive-body {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 0;
    flex: 1;
    overflow: hidden;
}

@media (max-width: 900px) {
    .modal-adaptive-body {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }
}

.modal-column-sticky {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.modal-footer-sticky {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
}

/* Specific Fixes for Business Modules & SweetAlert Integration */
#repair-details-modal-overlay .modal-content,
.citycell-modal-content,
.premium-popup,
.swal-premium-popup-compact {
    background: white !important;
    border-radius: var(--modal-radius) !important;
    box-shadow: var(--modal-shadow) !important;
    border: 1px solid #f1f5f9 !important;
    display: flex !important;
    flex-direction: column !important;
    max-height: 95vh !important;
    overflow: hidden !important;
}

.citycell-modal-header {
    background: white;
    padding: 32px 40px; /* Más espaciado interno */
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f1f5f9;
}

.citycell-modal-title {
    font-size: 1.25rem;
    font-weight: 850;
    color: #0f172a;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: -0.5px;
}

.citycell-close-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1.5px solid #f1f5f9;
    background: #f8fafc;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.citycell-close-btn:hover {
    background: #fee2e2;
    border-color: #fecaca;
    color: #ef4444;
    transform: rotate(90deg);
}

.citycell-modal-body {
    padding: 0 var(--space-xl) var(--space-xl) var(--space-xl);
    overflow-y: auto !important;
    flex: 1 !important;
}

.swal-premium-popup-compact {
    max-width: 450px !important;
    padding: 30px !important;
}

.citycell-modal-content {
    width: 95vw;
}

@media (min-width: 900px) {
    .citycell-modal-content {
        width: 100%;
        max-width: 95vw;
    }
}

/* ============================================================
   MISSING UTILITY CLASSES FOR MODAL LAYOUTS (CLIENT / DRAWER)
   ============================================================ */

/* Drawer Header — X button on the right */
.drawer-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid transparent;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

/* Full-width button used in client modal footer */
.btn-full-width {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
}

/* Modal width variants */
.modal-sm {
    max-width: 400px;
}

.modal-md {
    max-width: 650px;
}

.modal-lg {
    max-width: 900px;
}

/* Grid & Layout Utilities */
.citycell-modal-body {
    padding: 0 32px 32px 32px;
    overflow-y: auto;
}

.grid-3-cols-gap-12 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.grid-2-cols-gap-10 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.box-gray-padded {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 16px;
    padding: 20px;
    margin: 10px 0;
}

.image-upload-text {
    font-size: 0.8rem;
    font-weight: 800;
    color: #475569;
}

@media (max-width: 768px) {

    .grid-3-cols-gap-12,
    .grid-2-cols-gap-10 {
        grid-template-columns: 1fr;
    }

    .citycell-modal-body {
        padding: 0 20px 20px 20px;
    }
}