/* Estilos del módulo Directorio */

/* ============================================
   NUEVOS ESTILOS CON CLASES - RESPONSIVE
   ============================================ */

/* Header */
.dir-header {
    background: white;
    padding: 10px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.dir-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.dir-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dir-header-right {
    display: flex;
    gap: 10px;
}

.dir-btn-back {
    padding: 8px 12px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    color: #374151;
    font-size: 14px;
}

.dir-title {
    color: #2c3e50;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dir-btn-nuevo {
    padding: 10px 16px;
    border: none;
    background: #ec7063;
    color: white;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.dir-btn-nuevo:hover {
    background: #d95b4e;
}

/* Tabs */
.dir-tabs-container {
    background: #eef2f7;
    padding: 6px;
    border-radius: 10px;
    margin: 10px 16px;
}

.dir-tabs {
    display: flex;
    gap: 6px;
}

.dir-tab {
    flex: 1;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    color: #64748b;
    font-weight: 500;
    transition: all 0.2s;
}

.dir-tab:hover {
    background: rgba(255,255,255,0.5);
}

.dir-tab.active {
    background: #ffffff;
    color: #1e293b;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dir-tab-badge {
    background: #cbd5e1;
    color: #475569;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.dir-tab.active .dir-tab-badge {
    background: #2c3e50;
    color: white;
}

/* Filtros */
.dir-filters-container {
    background: white;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.dir-filters {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 10px;
    align-items: center;
}

.dir-search-box {
    position: relative;
}

.dir-search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 14px;
}

.dir-search-box input {
    width: 100%;
    padding: 10px 10px 10px 38px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    background: #f8fafc;
    transition: all 0.2s;
}

.dir-search-box input:focus {
    border-color: #2c3e50;
    background: white;
    outline: none;
}

.dir-filter-item select {
    width: 100%;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    color: #475569;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s;
}

.dir-filter-item select:focus {
    border-color: #2c3e50;
    background: white;
    outline: none;
}

/* Contenido */
.dir-content {
    background: #f8fafc;
    padding: 10px;
}

/* ============================================
   RESPONSIVE - MÓVIL
   ============================================ */

@media (max-width: 768px) {
    /* Header móvil */
    .dir-header {
        padding: 10px 12px;
    }

    .dir-header-content {
        flex-direction: column;
        align-items: stretch;
    }

    .dir-header-left {
        justify-content: flex-start;
        margin-bottom: 10px;
    }

    .dir-title {
        font-size: 0.85rem;
    }

    .dir-btn-nuevo {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
    }

    /* Tabs móvil - vertical */
    .dir-tabs-container {
        margin: 8px 12px;
        padding: 8px;
    }

    .dir-tabs {
        flex-direction: column;
        gap: 6px;
    }

    .dir-tab {
        justify-content: center;
        padding: 12px 16px;
        text-align: center;
    }

    /* Filtros móvil - vertical */
    .dir-filters-container {
        padding: 12px;
    }

    .dir-filters {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .dir-search-box input,
    .dir-filter-item select {
        padding: 12px;
        padding-left: 40px;
        font-size: 16px; /* Previene zoom en iOS */
    }

    .dir-filter-item select {
        padding-left: 12px;
    }

    /* Contenido móvil */
    .dir-content {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .dir-header {
        padding: 8px 10px;
    }

    .dir-title {
        font-size: 0.8rem;
    }

    .dir-title i {
        display: none;
    }

    .dir-tabs-container {
        margin: 6px 8px;
    }

    .dir-filters-container {
        padding: 10px 8px;
    }

    .dir-content {
        padding: 6px;
    }
}

/* ============================================
   TABLA RESPONSIVE
   ============================================ */

.dir-table-section {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.dir-table-header {
    background: #b1bcc4;
    padding: 8px 12px;
    border-bottom: 1px solid #9aa6af;
}

.dir-table-header h3 {
    color: #1e293b;
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dir-table-header h3 i {
    font-size: 14px;
}

.dir-table-count {
    display: inline-block;
    background: #2F3E4F;
    color: white;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    margin-left: auto;
}

.dir-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.dir-table {
    width: 100%;
    border-collapse: collapse;
}

.dir-table thead tr {
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}

.dir-table th {
    padding: 10px 8px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.dir-table-row {
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.2s;
}

.dir-table-row:hover {
    background: #f8fafc;
}

.dir-table td {
    padding: 10px 8px;
    font-size: 13px;
    color: #1e293b;
    vertical-align: middle;
}

.col-index {
    width: 40px;
    color: #64748b !important;
    font-weight: 600;
}

.col-acciones {
    text-align: center !important;
}

td.col-acciones .dir-actions {
    width: 100%;
}

.dir-nombre-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dir-nombre-cell i {
    font-size: 18px;
}

.dir-nombre-cell span {
    font-weight: 600;
}

.dir-link-tel,
.dir-link-email {
    color: #2c3e50;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.dir-link-tel:hover,
.dir-link-email:hover {
    color: #3498db;
}

.dir-link-email {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dir-empty {
    color: #94a3b8;
}

.dir-apt {
    font-weight: 600;
    color: #1e293b;
}

.dir-apt-empty {
    display: inline-block;
    background: #f1f5f9;
    color: #64748b;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.dir-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.dir-btn-edit,
.dir-btn-delete {
    padding: 8px 10px;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    font-size: 12px;
    transition: all 0.2s;
    color: white;
}

.dir-btn-edit {
    background: var(--btn-editar);
}

.dir-btn-edit:hover {
    background: var(--btn-editar-light);
}

.dir-btn-delete {
    background: var(--btn-eliminar);
}

.dir-btn-delete:hover {
    background: var(--btn-eliminar-light);
}

.dir-btn-duplicate {
    background: var(--btn-copiar);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.dir-btn-duplicate:hover {
    background: var(--btn-copiar-light);
}

.dir-badge-tipo {
    display: inline-block;
    background: #3b82f6;
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

.dir-badge-contrato {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    color: white;
}

.dir-badge-contrato.vigente {
    background: #10b981;
}

.dir-badge-contrato.vencido {
    background: #ef4444;
}

.dir-table-scroll-hint {
    display: none;
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
    padding: 6px;
    background: #f1f5f9;
}

/* Mostrar/ocultar en móvil */
.show-mobile-inline {
    display: none;
}

/* Responsive tabla - estilos básicos, responsive.css tiene prioridad */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }

    .show-mobile-inline {
        display: inline !important;
    }
}

@media (max-width: 480px) {
    .dir-table-header {
        padding: 6px 10px;
    }

    .dir-table-header h3 {
        font-size: 11px;
    }

    .dir-table th,
    .dir-table td {
        padding: 6px 4px;
        font-size: 11px;
    }

    .dir-nombre-cell i {
        font-size: 16px;
    }
}

/* ============================================
   ESTILOS ORIGINALES
   ============================================ */

/* Estilos para la vista de tabla */
.propietarios-table-container,
.representantes-table-container,
.inquilinos-table-container {
    padding: 0;
}

.edificio-section {
    margin-bottom: 30px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.edificio-title {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    margin: 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.edificio-title .badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 0.9rem;
    margin-left: auto;
}

.table-responsive {
    overflow-x: auto;
    padding: 20px;
}

.propietarios-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    border: 2px solid #000;
}

.propietarios-table thead {
    background: #e7e7e7;
    border-bottom: 2px solid #000;
}

.propietarios-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #000;
    border: 1px solid #a0a0a0;
    background: #e7e7e7;
}

.propietarios-table tbody tr {
    transition: background-color 0.2s;
}

.propietarios-table tbody tr:hover {
    background-color: #fffacd;
}

.propietarios-table td {
    padding: 10px 12px;
    vertical-align: middle;
    border: 1px solid #c0c0c0;
    background: white;
}

.owner-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.owner-name i {
    font-size: 1.2rem;
}

.phone-link, .email-link {
    color: #007bff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.phone-link:hover, .email-link:hover {
    text-decoration: underline;
}

.action-buttons {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.btn-action {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-action.btn-edit {
    background: #28a745;
    color: white;
}

.btn-action.btn-edit:hover {
    background: #218838;
    transform: scale(1.1);
}

.btn-action.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-action.btn-delete:hover {
    background: #c82333;
    transform: scale(1.1);
}

.badge {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-primary {
    background: #007bff;
    color: white;
}

.badge-secondary {
    background: #6c757d;
    color: white;
}

.text-success {
    color: #28a745;
}

.text-secondary {
    color: #6c757d;
}

.text-muted {
    color: #999;
    font-style: italic;
}

.text-center {
    text-align: center;
}

/* Tabs de navegación */
.directory-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    padding: 15px;
    background: var(--background-color);
    border-radius: 8px;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.95rem;
    color: var(--text-color);
}

.tab-btn:hover {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-color: var(--primary-color);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--text-white);
    border-color: var(--primary-color);
}

.tab-btn .badge {
    background: rgba(255, 255, 255, 0.3);
    color: inherit;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.tab-btn:not(.active) .badge {
    background: var(--primary-color);
    color: var(--text-white);
}

/* Controles del directorio */
.directory-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.directory-controls .search-box {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.directory-controls .search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.directory-controls .search-box input {
    padding-left: 40px;
    width: 100%;
}

.filter-group {
    display: flex;
    gap: 10px;
}

.filter-group select {
    min-width: 150px;
}

/* Grid del directorio */
.directory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

/* Cards del directorio */
.directory-card {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border-radius: 12px;
    border: 2px solid var(--border-color);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.directory-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-light);
}

.directory-card .card-header {
    padding: 15px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--text-white);
}

.person-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.person-info h4 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.person-info h4 i {
    font-size: 1.2rem;
    opacity: 0.9;
}

.directory-card .card-body {
    padding: 15px;
    flex-grow: 1;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: var(--text-color);
    font-size: 0.9rem;
}

.info-row i {
    width: 20px;
    text-align: center;
    color: var(--primary-color);
}

.info-row span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.info-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: linear-gradient(135deg, var(--success-color), #27ae60);
    color: var(--text-white);
    border-radius: 20px;
    font-size: 0.85rem;
    margin-right: 8px;
    margin-top: 10px;
}

.info-tag.secondary {
    background: linear-gradient(135deg, #7f8c8d, #95a5a6);
}

.info-tag.warning {
    background: linear-gradient(135deg, var(--warning-color), #f39c12);
}

.info-tag.danger {
    background: linear-gradient(135deg, var(--danger-color), #c0392b);
}

.directory-card .card-footer {
    padding: 12px 15px;
    background: var(--background-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    justify-content: center;
    justify-content: flex-end;
}

/* Estado vacío */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state i {
    color: var(--primary-light);
    opacity: 0.3;
    margin-bottom: 20px;
}

.empty-state h3 {
    color: var(--text-color);
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--text-light);
}

/* Formularios del directorio */
.form-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h4 {
    color: var(--text-color);
    margin-bottom: 20px;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section h4 i {
    color: var(--primary-color);
}

.form-label.required::after {
    content: ' *';
    color: var(--danger-color);
}

select[multiple] {
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 8px;
}

select[multiple] option {
    padding: 5px 10px;
}

select[multiple] option:checked {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--text-white);
}

/* Modal de detalles */
.details-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s;
}

.details-content {
    background: var(--white);
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
}

.details-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--text-white);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.details-body {
    padding: 30px;
}

.details-section {
    margin-bottom: 25px;
}

.details-section h5 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.1rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.detail-item label {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 600;
}

.detail-item span {
    color: var(--text-color);
    font-size: 1rem;
}

/* Table Styles */
.table-responsive {
    overflow-x: auto;
    margin: 20px 0;
}

.directory-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--text-white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.directory-table thead {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--text-white);
}

.directory-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.directory-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.directory-table tbody tr:hover {
    background-color: var(--background-color);
}

.directory-table td {
    padding: 12px 15px;
    color: var(--text-color);
    font-size: 0.95rem;
}

.name-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.name-cell i {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.name-cell .fa-home,
.name-cell .fa-car,
.name-cell .fa-paw {
    margin-left: 8px;
    font-size: 0.9rem;
}

.action-buttons {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.action-buttons .btn {
    padding: 4px 8px;
}

.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-block;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-secondary {
    background: #e2e3e5;
    color: #383d41;
}

.text-muted {
    color: #6c757d;
    font-style: italic;
}

.text-primary {
    color: var(--primary-color);
}

.text-info {
    color: #17a2b8;
}

.text-warning {
    color: #ffc107;
}

/* Selector de apartamentos - Dropdown Style */
.apartment-dropdown-selector {
    position: relative;
    width: 100%;
}

.selected-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--text-white);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    min-height: 45px;
    transition: all 0.3s ease;
}

.selected-display:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 144, 220, 0.1);
}

.selected-items {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.selected-tag {
    display: inline-block;
    padding: 4px 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--text-white);
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 500;
}

.placeholder {
    color: #999;
    font-style: italic;
}

.dropdown-arrow {
    color: #666;
    transition: transform 0.3s ease;
}

.dropdown-arrow.rotate {
    transform: rotate(180deg);
}

.apartment-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 5px;
    background: var(--text-white);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 400px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dropdown-search {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.dropdown-list {
    flex: 1;
    overflow-y: auto;
    max-height: 250px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-item:hover {
    background-color: var(--background-color);
}

.dropdown-item.selected {
    background-color: rgba(52, 144, 220, 0.1);
}

.dropdown-item input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
}

.dropdown-item span {
    flex: 1;
    font-size: 0.95rem;
}

.contract-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.contract-info .badge {
    font-size: 0.75rem;
    padding: 3px 8px;
}

.contract-info small {
    font-size: 0.8rem;
    color: #666;
    margin-top: 2px;
}

.owner-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.owner-name i {
    font-size: 1.1rem;
}

.phone-link, .email-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.phone-link:hover {
    color: #28a745;
}

.email-link:hover {
    color: #007bff;
}

.phone-link i, .email-link i {
    margin-right: 5px;
    font-size: 0.9rem;
}

/* Estilos para la tabla responsive */
.table-responsive {
    overflow-x: auto;
    margin-bottom: 20px;
}

.propietarios-table .btn-group {
    display: flex;
    gap: 4px;
}

.propietarios-table .actions-cell {
    white-space: nowrap;
}

.dropdown-actions {
    padding: 10px;
    border-top: 1px solid var(--border-color);
    text-align: right;
}

/* Legacy styles for compatibility */
.apartment-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.apartment-selector select {
    flex: 1;
}

.selected-apartments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    min-height: 40px;
    padding: 8px;
    background: var(--background-color);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.apartment-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--text-white);
    border-radius: 20px;
    font-size: 0.9rem;
}

.apartment-tag .remove-btn {
    background: none;
    border: none;
    color: var(--text-white);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.apartment-tag .remove-btn:hover {
    opacity: 1;
}

/* Responsive */
@media (max-width: 992px) {
    .directory-tabs {
        flex-direction: column;
    }
    
    .directory-grid {
        grid-template-columns: 1fr;
    }
    
    .directory-controls {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
        flex-direction: column;
    }
    
    .filter-group select {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .person-info {
        flex-direction: column;
        align-items: flex-start;
    }

    .info-row {
        font-size: 0.85rem;
    }

    .directory-card .card-footer {
        justify-content: center;
    }
}

/* ============================================
   ESTILOS RESPONSIVE PARA MÓVIL - DIRECTORIO
   ============================================ */

/* Tablet y móvil grande (max 992px) */
@media (max-width: 992px) {
    /* Header del módulo */
    #moduleContainer > div:first-child > div:first-child {
        flex-direction: column !important;
        gap: 10px !important;
        align-items: stretch !important;
    }

    #moduleContainer > div:first-child > div:first-child > div:last-child {
        justify-content: flex-end !important;
    }
}

/* Móvil (max 768px) */
@media (max-width: 768px) {
    /* Barra de búsqueda y filtros - apilar verticalmente */
    #moduleContainer > div:nth-child(3) > div {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    /* Tabs - hacer más compactos */
    #moduleContainer > div:nth-child(2) > div {
        flex-wrap: wrap !important;
    }

    #moduleContainer > div:nth-child(2) button {
        flex: 1 1 calc(33% - 4px) !important;
        min-width: 100px !important;
        padding: 8px 6px !important;
        font-size: 11px !important;
    }

    /* Contenedor de tablas */
    .propietarios-table-container,
    .representantes-table-container,
    .inquilinos-table-container {
        padding: 0 !important;
    }

    /* Secciones de edificio */
    #moduleContainer [style*="border-radius: 8px"][style*="margin-bottom: 10px"] {
        margin: 0 -10px 10px -10px !important;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
    }

    /* Título del edificio */
    #moduleContainer [style*="background: #b1bcc4"] h3 {
        font-size: 12px !important;
    }

    /* Tablas - scroll horizontal visible */
    #moduleContainer [style*="overflow-x: auto"] {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    /* Indicador de scroll en tablas */
    #moduleContainer [style*="overflow-x: auto"]::after {
        content: '← Desliza →';
        display: block;
        text-align: center;
        font-size: 10px;
        color: #94a3b8;
        padding: 4px;
        background: #f1f5f9;
    }

    /* Celdas de tabla más compactas */
    #moduleContainer table th,
    #moduleContainer table td {
        padding: 6px 4px !important;
        font-size: 11px !important;
    }

    /* Ocultar columnas menos importantes en móvil */
    #moduleContainer table th:nth-child(4),
    #moduleContainer table td:nth-child(4),
    #moduleContainer table th:nth-child(6),
    #moduleContainer table td:nth-child(6) {
        display: none !important;
    }

    /* Botones de acción más grandes para touch */
    #moduleContainer table button {
        padding: 8px 10px !important;
        min-width: 36px !important;
        min-height: 36px !important;
    }

    /* Input de búsqueda más grande */
    #searchDirectory {
        padding: 10px 10px 10px 36px !important;
        font-size: 14px !important;
    }

    /* Selects más grandes */
    #filterEdificio,
    #filterEstado {
        padding: 10px !important;
        font-size: 14px !important;
    }

    /* Botón nuevo registro */
    #btnNuevoRegistro {
        width: 100% !important;
        padding: 10px 15px !important;
        font-size: 14px !important;
    }
}

/* Móvil pequeño (max 480px) */
@media (max-width: 480px) {
    /* Header más compacto */
    #moduleContainer > div:first-child {
        padding: 8px 10px !important;
    }

    #moduleContainer > div:first-child h2 {
        font-size: 0.8rem !important;
    }

    /* Tabs en una columna en móviles muy pequeños */
    #moduleContainer > div:nth-child(2) {
        padding: 3px !important;
        margin: 5px 8px !important;
    }

    #moduleContainer > div:nth-child(2) > div {
        flex-direction: column !important;
        gap: 4px !important;
    }

    #moduleContainer > div:nth-child(2) button {
        width: 100% !important;
        flex: none !important;
        padding: 10px !important;
        font-size: 13px !important;
    }

    /* Búsqueda y filtros */
    #moduleContainer > div:nth-child(3) {
        padding: 8px 10px !important;
    }

    /* Área de contenido */
    #directoryContentArea {
        padding: 5px !important;
    }

    /* Ocultar más columnas en móvil pequeño */
    #moduleContainer table th:nth-child(3),
    #moduleContainer table td:nth-child(3),
    #moduleContainer table th:nth-child(5),
    #moduleContainer table td:nth-child(5) {
        display: none !important;
    }

    /* Mostrar solo nombre, apartamento y acciones */
    #moduleContainer table th:first-child,
    #moduleContainer table td:first-child {
        width: 30px !important;
    }

    /* Hacer el nombre más visible */
    #moduleContainer table td:nth-child(2) span {
        font-size: 13px !important;
        font-weight: 600 !important;
    }

    /* Centrar acciones */
    #moduleContainer table td:last-child > div {
        flex-direction: row !important;
        gap: 8px !important;
    }
}

/* Mejoras generales para touch */
@media (pointer: coarse) {
    /* Botones más grandes para dedos */
    #moduleContainer button {
        min-height: 44px;
        min-width: 44px;
    }

    /* Links telefónicos y email clickeables */
    #moduleContainer a[href^="tel:"],
    #moduleContainer a[href^="mailto:"] {
        padding: 8px 4px;
        display: inline-block;
    }

    /* Mejor espaciado entre elementos interactivos */
    #moduleContainer table td button {
        margin: 2px;
    }
}