/**
 * InmoWeb CRM - Modules Specific Component Styles
 * Modules: Dashboard KPIs, Kanban Pipeline, Unit Matrix, Property Timeline,
 * Contract Expirations, Agenda Calendar, Export Center, Feedback Modal.
 */

/* ── 1. DASHBOARD MODULE ── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent);
}
.kpi-card.kpi-emerald::before { background: var(--success); }
.kpi-card.kpi-purple::before { background: var(--purple); }
.kpi-card.kpi-amber::before { background: var(--warning); }
.kpi-card.kpi-rose::before { background: var(--danger); }

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.kpi-emerald .kpi-icon { background: var(--success-bg); color: var(--success); }
.kpi-purple .kpi-icon { background: var(--purple-bg); color: var(--purple); }
.kpi-amber .kpi-icon { background: var(--warning-bg); color: var(--warning); }
.kpi-rose .kpi-icon { background: var(--danger-bg); color: var(--danger); }

.kpi-data {
    display: flex;
    flex-direction: column;
}
.kpi-val {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.1;
}
.kpi-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 4px;
}

/* Alert Banner on Dashboard */
.alert-banner {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fde68a;
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.alert-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #92400e;
    font-weight: 600;
    font-size: 0.9rem;
}
.alert-banner-icon {
    font-size: 1.4rem;
    color: #d97706;
}

/* ── 2. PROPERTIES MODULE ── */
.properties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 22px;
}

.property-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
    display: flex;
    flex-direction: column;
}
.property-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.property-cover {
    position: relative;
    height: 190px;
    background: #e2e8f0;
    overflow: hidden;
}
.property-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.property-card:hover .property-cover img {
    transform: scale(1.05);
}

.property-badge-group {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.property-price-tag {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(6px);
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 800;
}

.property-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.property-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
    line-height: 1.3;
}
.property-location {
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
}
.property-features {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 14px;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.property-feature-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.property-commission-banner {
    background: #f0fdf4;
    border: 1px dashed #86efac;
    color: #166534;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.property-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

/* Photo Uploader Component */
.photo-dropzone {
    border: 2px dashed var(--accent);
    background: #f0f9ff;
    border-radius: var(--radius-lg);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-fast);
}
.photo-dropzone:hover {
    background: #e0f2fe;
    border-color: var(--accent-hover);
    transform: translateY(-1px);
}
body.dark-theme .photo-dropzone {
    background: rgba(2, 132, 199, 0.08);
    border-color: #0284c7;
}

.photo-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-top: 14px;
}
.photo-thumb-card {
    position: relative;
    height: 90px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--border-color);
    background: #e2e8f0;
}
.photo-thumb-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.photo-thumb-card.is-cover {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.35);
}
.photo-thumb-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    background: var(--accent);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}
.photo-thumb-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.photo-thumb-delete:hover {
    background: #dc2626;
}

/* ── 3. TIMELINE COMPONENT ── */
.timeline-container {
    position: relative;
    padding-left: 28px;
    margin-top: 18px;
}
.timeline-container::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border-color);
}
.timeline-item {
    position: relative;
    margin-bottom: 20px;
}
.timeline-item:last-child {
    margin-bottom: 0;
}
.timeline-dot {
    position: absolute;
    left: -28px;
    top: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--bg-surface);
    box-shadow: 0 0 0 2px var(--border-color);
}
.timeline-content {
    background: var(--bg-main);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}
.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.timeline-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
}
.timeline-time {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.timeline-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ── 4. KANBAN PIPELINE (LEADS) ── */
.kanban-board-container {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 20px;
    min-height: 560px;
}
.kanban-col {
    background: #f1f5f9;
    border-radius: var(--radius-lg);
    width: 280px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    padding: 12px;
    border: 1px solid var(--border-color);
}
body.dark-theme .kanban-col {
    background: #111827;
}
.kanban-col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}
body.dark-theme .kanban-col-header {
    border-bottom-color: #374151;
}
.kanban-col-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}
.kanban-counter {
    background: #e2e8f0;
    color: var(--text-main);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}
body.dark-theme .kanban-counter {
    background: #374151;
}

.kanban-cards-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-height: 200px;
}
.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    transition: var(--transition-fast);
    border-left: 4px solid var(--accent);
}
.kanban-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.kanban-card.dragging {
    opacity: 0.4;
    cursor: grabbing;
}
.kanban-card-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}
.kanban-card-budget {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--success);
    margin-bottom: 6px;
}
.kanban-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-color);
}

/* ── 5. UNIT INVENTORY MATRIX (PROJECTS) ── */
.unit-matrix-view {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.matrix-floor-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    padding: 12px 18px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}
.floor-badge {
    width: 90px;
    font-weight: 800;
    font-size: 0.88rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
.floor-units-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
}

.unit-cell {
    width: 105px;
    height: 72px;
    border-radius: var(--radius-md);
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.unit-cell:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}
.unit-cell.unit-available { background: #dcfce7; color: #166534; border-color: #86efac; }
.unit-cell.unit-separated { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.unit-cell.unit-reserved { background: #fef9c3; color: #854d0e; border-color: #fef08a; }
.unit-cell.unit-negotiation { background: #f3e8ff; color: #6b21a8; border-color: #d8b4fe; }
.unit-cell.unit-sold { background: #059669; color: white; border-color: #047857; }
.unit-cell.unit-blocked { background: #f1f5f9; color: #64748b; border-color: #cbd5e1; }

.unit-cell-code {
    font-weight: 800;
    font-size: 0.8rem;
}
.unit-cell-price {
    font-size: 0.7rem;
    font-weight: 600;
}
.unit-cell-area {
    font-size: 0.65rem;
    opacity: 0.85;
}

/* ── 6. CONTRACT EXPIRATION CHIPS ── */
.contract-alert-card {
    border-left: 4px solid var(--warning);
    background: #fffdf5;
}
.contract-alert-card.is-expired {
    border-left-color: var(--danger);
    background: #fff5f5;
}

/* ── 7. AGENDA CALENDAR GRID ── */
.agenda-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.appointment-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    border-left: 4px solid var(--accent);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
}
.appointment-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.appointment-time {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── 8. EXPORT CENTER ── */
.export-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.export-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.export-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}
.export-btn-group {
    display: flex;
    gap: 8px;
    width: 100%;
    margin-top: 8px;
}
.export-btn-group .btn {
    flex: 1;
}

/* ── 9. CALCULADORA HIPOTECARIA & FINANCIERA ── */
.calc-main-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 24px;
}

@media (max-width: 900px) {
    .calc-main-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ── 10. INTERACTIVE PHOTO GALLERY & LIGHTBOX ── */
.inmoweb-gallery-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}
.gallery-main-frame {
    position: relative;
    width: 100%;
    height: 320px;
    background: #0f172a;
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: zoom-in;
    box-shadow: var(--shadow-md);
}
.gallery-main-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.25s ease-in-out, transform 0.3s ease;
}
.gallery-main-frame:hover .gallery-main-img {
    transform: scale(1.02);
}
.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(15, 23, 42, 0.65);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    z-index: 5;
    backdrop-filter: blur(4px);
    transition: all 0.2s;
}
.gallery-arrow:hover {
    background: rgba(2, 132, 199, 0.9);
    transform: translateY(-50%) scale(1.1);
}
.gallery-arrow.arrow-left {
    left: 12px;
}
.gallery-arrow.arrow-right {
    right: 12px;
}
.gallery-top-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    z-index: 5;
}
.gallery-counter-badge {
    background: rgba(15, 23, 42, 0.75);
    color: #f8fafc;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    backdrop-filter: blur(4px);
}
.gallery-zoom-badge {
    pointer-events: auto;
    background: rgba(2, 132, 199, 0.85);
    color: #ffffff;
    border: none;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(4px);
    transition: background 0.2s, transform 0.2s;
}
.gallery-zoom-badge:hover {
    background: #0284c7;
    transform: scale(1.05);
}

/* Thumbs Strip */
.gallery-thumbs-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.gallery-thumbs-strip::-webkit-scrollbar {
    height: 5px;
}
.gallery-thumbs-strip::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.gallery-thumb-item {
    width: 68px;
    height: 52px;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    border: 2px solid transparent;
    opacity: 0.6;
    transition: all 0.2s;
}
.gallery-thumb-item.active, .gallery-thumb-item:hover {
    opacity: 1;
    border-color: var(--accent);
    transform: translateY(-2px);
}
.gallery-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Multimedia Buttons Bar */
.gallery-multimedia-bar {
    display: flex;
    gap: 10px;
    margin-top: 4px;
    flex-wrap: wrap;
}
.btn-media {
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn-video {
    background: #fee2e2;
    color: #dc2626;
}
.btn-video:hover {
    background: #fecaca;
    transform: translateY(-2px);
}
.btn-360 {
    background: #e0f2fe;
    color: #0369a1;
}
.btn-360:hover {
    background: #bae6fd;
    transform: translateY(-2px);
}

/* Lightbox Fullscreen */
.inmoweb-lightbox-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 15, 29, 0.96);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: none;
    flex-direction: column;
    justify-content: space-between;
}
.inmoweb-lightbox-overlay.active {
    display: flex;
}
.lightbox-top-bar {
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ffffff;
}
.lightbox-counter {
    font-size: 0.95rem;
    font-weight: 700;
    color: #94a3b8;
}
.lightbox-close-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.lightbox-close-btn:hover {
    background: rgba(239, 68, 68, 0.8);
}
.lightbox-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    position: relative;
}
.lightbox-arrow {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}
.lightbox-arrow:hover {
    background: rgba(2, 132, 199, 0.9);
    transform: scale(1.1);
}
.lightbox-img-wrapper {
    max-width: 85vw;
    max-height: 75vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}
.lightbox-img-wrapper img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    transition: opacity 0.2s ease-in-out;
}
.lightbox-thumbs-bar {
    padding: 14px 20px 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
    overflow-x: auto;
}
.lightbox-thumb-item {
    width: 64px;
    height: 48px;
    border-radius: var(--radius-md);
    overflow: hidden;
    opacity: 0.5;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}
.lightbox-thumb-item.active, .lightbox-thumb-item:hover {
    opacity: 1;
    border-color: #38bdf8;
    transform: scale(1.05);
}
.lightbox-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Media Modal (YouTube/360) Container */
.media-modal-container {
    flex: 1;
    max-width: 960px;
    width: 100%;
    max-height: 80vh;
    height: 540px;
    margin: 0 auto 30px;
    padding: 0 16px;
}
