/* ═══════════════════════════════════════════════════════════════════════
   CLICK REGISTRO - ESTILOS PRINCIPALES (TEMA CLARO)
   Colores corporativos Click: Púrpura profundo #2D1066, Teal #2EC4B6
   ═══════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-primary: #f4f6fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8f9fc;
    --bg-input: #f0f2f7;
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a6a;
    --text-muted: #8888a8;
    --accent-primary: #2EC4B6;
    --accent-secondary: #8B5CF6;
    --accent-gradient: linear-gradient(135deg, #2EC4B6 0%, #8B5CF6 100%);
    --accent-pink: #e84393;
    --accent-green: #00b894;
    --accent-orange: #f39c12;
    --brand-purple: #2D1066;
    --brand-teal: #2EC4B6;
    --border-color: #e2e5ef;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 50px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ── Layout ────────────────────────────────────────────────────────── */

.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--brand-purple);
    padding: 24px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 30px 40px;
    min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────────────── */

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.sidebar-brand img {
    height: 42px;
    width: auto;
}

.sidebar-nav {
    list-style: none;
    padding: 0 12px;
}

.sidebar-nav li {
    margin-bottom: 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.sidebar-nav a.active {
    background: rgba(46, 196, 182, 0.25);
    color: var(--accent-primary);
    font-weight: 600;
}

.sidebar-nav a i {
    font-size: 18px;
    width: 22px;
    text-align: center;
}

.sidebar-section {
    padding: 16px 24px 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.4);
}

/* ── Header ────────────────────────────────────────────────────────── */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
}

.page-header .subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Cards ─────────────────────────────────────────────────────────── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* ── Stat Cards ────────────────────────────────────────────────────── */

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.purple {
    background: rgba(139, 92, 246, 0.12);
    color: #8B5CF6;
}

.stat-icon.pink {
    background: rgba(232, 67, 147, 0.12);
    color: #e84393;
}

.stat-icon.green {
    background: rgba(46, 196, 182, 0.12);
    color: #2EC4B6;
}

.stat-icon.orange {
    background: rgba(243, 156, 18, 0.12);
    color: #f39c12;
}

.stat-icon.blue {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
}

.stat-info h4 {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
}

.stat-info p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Tables ────────────────────────────────────────────────────────── */

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

thead th {
    padding: 14px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
    background: var(--bg-input);
}

tbody td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

tbody tr:hover {
    background: var(--bg-card-hover);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ── Buttons ───────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--brand-purple);
    color: #fff;
    box-shadow: 0 4px 12px rgba(45, 16, 102, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(45, 16, 102, 0.35);
    background: #3a1580;
}

.btn-success {
    background: var(--accent-primary);
    color: #fff;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 196, 182, 0.3);
}

.btn-danger {
    background: #e84393;
    color: #fff;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(232, 67, 147, 0.3);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-warning {
    background: #f39c12;
    color: #fff;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 15px;
    border-radius: var(--radius-full);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* ── Forms ─────────────────────────────────────────────────────────── */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 3px rgba(45, 16, 102, 0.1);
    background: #fff;
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238888a8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ── Badges ────────────────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-activa {
    background: rgba(46, 196, 182, 0.12);
    color: #0e9e92;
}

.badge-finalizada {
    background: rgba(136, 136, 168, 0.12);
    color: var(--text-muted);
}

.badge-propietario {
    background: rgba(45, 16, 102, 0.1);
    color: var(--brand-purple);
}

.badge-apoderado {
    background: rgba(243, 156, 18, 0.12);
    color: #d68910;
}

.badge-registrado {
    background: rgba(46, 196, 182, 0.12);
    color: #0e9e92;
}

.badge-pendiente {
    background: rgba(232, 67, 147, 0.1);
    color: #e84393;
}

/* ── Modal ─────────────────────────────────────────────────────────── */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 30px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}

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

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(232, 67, 147, 0.1);
    color: var(--accent-pink);
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* ── Alerts ────────────────────────────────────────────────────────── */

.alert {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: rgba(46, 196, 182, 0.1);
    border: 1px solid rgba(46, 196, 182, 0.2);
    color: #0e9e92;
}

.alert-error {
    background: rgba(232, 67, 147, 0.08);
    border: 1px solid rgba(232, 67, 147, 0.2);
    color: #e84393;
}

.alert-info {
    background: rgba(45, 16, 102, 0.06);
    border: 1px solid rgba(45, 16, 102, 0.12);
    color: var(--brand-purple);
}

/* ── Progress / Quorum ─────────────────────────────────────────────── */

.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.quorum-panel {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.quorum-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.quorum-stat {
    text-align: center;
}

.quorum-stat .value {
    font-size: 32px;
    font-weight: 800;
    color: var(--brand-purple);
}

.quorum-stat .label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

/* ── Search box ────────────────────────────────────────────────────── */

.search-box {
    position: relative;
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 4px rgba(45, 16, 102, 0.1);
    background: #fff;
}

.search-box i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
}

/* ── Search results ────────────────────────────────────────────────── */

.search-results {
    margin-bottom: 20px;
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: var(--transition);
    cursor: pointer;
}

.result-item:hover {
    border-color: var(--brand-purple);
    background: rgba(45, 16, 102, 0.03);
}

.result-item.selected {
    border-color: var(--accent-primary);
    background: rgba(46, 196, 182, 0.06);
}

.result-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.result-item .info {
    flex: 1;
}

.result-item .info .name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.result-item .info .detail {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.result-item .coef {
    font-size: 13px;
    font-weight: 700;
    color: var(--brand-purple);
    margin-left: 16px;
}

.result-item .check {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    margin-right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.result-item.selected .check {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

/* ── Registration panel ────────────────────────────────────────────── */

.registro-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
}

.registro-sidebar {
    position: sticky;
    top: 30px;
    align-self: start;
}

/* ── Control assignment ────────────────────────────────────────────── */

.control-input {
    display: flex;
    align-items: center;
    gap: 12px;
}

.control-input input {
    width: 120px;
    padding: 14px 18px;
    font-size: 20px;
    font-weight: 800;
    text-align: center;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--brand-purple);
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
}

.control-input input:focus {
    outline: none;
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 4px rgba(45, 16, 102, 0.1);
    background: #fff;
}

/* ── Selected inmuebles panel ──────────────────────────────────────── */

.selected-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 13px;
    border: 1px solid var(--border-color);
}

.selected-item .name {
    font-weight: 600;
    color: var(--text-primary);
}

.selected-item .coef {
    color: var(--brand-purple);
    font-weight: 700;
}

.coef-total-box {
    background: var(--brand-purple);
    color: #fff;
    padding: 16px;
    border-radius: var(--radius-md);
    text-align: center;
    margin: 16px 0;
}

.coef-total-box .value {
    font-size: 28px;
    font-weight: 800;
}

.coef-total-box .label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.8;
    margin-top: 4px;
}

/* ── File upload area ──────────────────────────────────────────────── */

.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.file-upload-area:hover {
    border-color: var(--brand-purple);
    background: rgba(45, 16, 102, 0.03);
}

.file-upload-area.dragover {
    border-color: var(--brand-purple);
    background: rgba(45, 16, 102, 0.06);
}

.file-upload-area i {
    font-size: 36px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.file-upload-area p {
    color: var(--text-muted);
    font-size: 14px;
}

.file-upload-area input[type="file"] {
    display: none;
}

/* ── Loading spinner ───────────────────────────────────────────────── */

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--brand-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Toast ─────────────────────────────────────────────────────────── */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    min-width: 280px;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-success {
    background: #f0faf9;
    border: 1px solid rgba(46, 196, 182, 0.3);
    color: #0e9e92;
}

.toast-error {
    background: #fdf0f5;
    border: 1px solid rgba(232, 67, 147, 0.3);
    color: #e84393;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── Empty state ───────────────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
}

/* ── Action bar ────────────────────────────────────────────────────── */

.action-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ── Responsive ────────────────────────────────────────────────────── */

@media (max-width: 1200px) {
    .registro-layout {
        grid-template-columns: 1fr;
    }

    .registro-sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 20px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .quorum-stats {
        grid-template-columns: 1fr 1fr;
    }
}
