/* ============================================
   REGISTRO IMMOBILI - Pagina Lista
   Riusa variabili CSS da style.css
   ============================================ */

.registro-page {
    margin: 0;
    padding: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
}

/* ==================== HEADER ==================== */

/* Wrapper sticky per header + filtri */
.registro-sticky-top {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-secondary);
}

.registro-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.registro-header-left {
    flex: 1;
}

.registro-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
    padding: 4px 12px;
    border-radius: 6px;
}

.registro-nav-link:hover {
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
}

.registro-header-center {
    flex: 2;
    text-align: center;
}

.registro-header-center h1 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.registro-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.registro-header-right {
    flex: 1;
    text-align: right;
}

.registro-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ==================== FILTRI ==================== */

.registro-filters {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
}

.registro-filters-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.registro-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 120px;
}

.registro-filter-group label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
}

.registro-filter-group input,
.registro-filter-group select {
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.registro-filter-group input:focus,
.registro-filter-group select:focus {
    border-color: var(--accent-blue);
}

.registro-filter-group input::placeholder {
    color: var(--text-muted);
}

.registro-filters-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.registro-filters-actions .btn {
    padding: 6px 18px;
    font-size: 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

.registro-filters-actions .btn:hover {
    opacity: 0.85;
}

.registro-filters-actions .btn-primary {
    background: var(--accent-blue);
    color: #fff;
}

.registro-filters-actions .btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.registro-results-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-left: 8px;
}

.registro-filters-actions .btn-export,
.registro-filters-actions .btn-export-all {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #217346;
    color: #fff;
    margin-left: auto;
}

.registro-filters-actions .btn-export-all {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid rgba(255,255,255,0.1);
}

mark.search-highlight {
    background: #facc15 !important;
    color: #000 !important;
    border-radius: 2px;
    padding: 1px 2px;
}

.match-extra {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 350px;
}

.match-extra-label {
    font-weight: 600;
    color: var(--text-secondary);
}

/* ==================== TABELLA ==================== */

.registro-table-wrapper {
    overflow-x: auto;
    padding: 0 24px;
}

.registro-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 8px;
}

.registro-table thead {
    z-index: 10;
}

.registro-table th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    user-select: none;
}

.registro-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.registro-table th.sortable:hover {
    color: var(--accent-blue);
}

.registro-table th.sort-asc,
.registro-table th.sort-desc {
    color: var(--accent-blue, #60a5fa);
}

.registro-table th.sort-asc::after {
    content: ' ▲';
    font-size: 0.75rem;
    color: var(--accent-blue, #60a5fa);
}

.registro-table th.sort-desc::after {
    content: ' ▼';
    font-size: 0.75rem;
    color: var(--accent-blue, #60a5fa);
}

.registro-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
    vertical-align: middle;
}

.registro-table tbody tr {
    transition: background 0.15s;
}

.registro-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.08);
}

/* Colonne */
.col-num { width: 40px; text-align: center; color: var(--text-muted); }
.col-codice { min-width: 80px; font-weight: 600; }
.col-tipo { width: 90px; }
.col-comune { min-width: 120px; }
.col-foglio { width: 40px; text-align: center; }
.col-part { width: 60px; text-align: center; }
.col-sub { width: 40px; text-align: center; }
.col-cat { width: 60px; }
.col-denom { min-width: 150px; max-width: 250px; }
.col-parr { min-width: 120px; max-width: 200px; }
.col-geom { width: 50px; text-align: center; }
.col-tour { width: 50px; text-align: center; }
.col-azioni { width: 90px; text-align: center; }

/* Badges */
.badge-tipo {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-fabbricato {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

.badge-terreno {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.badge-geom {
    font-size: 0.9rem;
}

.badge-tour {
    font-size: 0.9rem;
}

/* Denom/Parr truncated */
.td-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

/* Azioni */
.registro-btn-scheda {
    display: inline-block;
    padding: 3px 10px;
    background: var(--accent-purple, #8b5cf6);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 500;
    transition: opacity 0.2s;
}

.registro-btn-scheda:hover {
    opacity: 0.85;
}

/* ==================== PAGINAZIONE ==================== */

.registro-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    position: sticky;
    bottom: 0;
}

.registro-pagination .btn-sm {
    padding: 5px 14px;
    font-size: 0.82rem;
    border-radius: 5px;
    cursor: pointer;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: background 0.2s;
}

.registro-pagination .btn-sm:hover {
    background: var(--accent-blue);
    color: #fff;
}

.registro-pagination .btn-sm:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.registro-page-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.registro-pagination select {
    padding: 5px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 0.82rem;
}

/* ==================== EMPTY STATE ==================== */

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

.registro-empty p {
    font-size: 1rem;
    margin-bottom: 8px;
}

.registro-empty span {
    font-size: 0.85rem;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
    .registro-filters-row {
        flex-direction: column;
    }

    .registro-filter-group {
        min-width: 100%;
    }

    .registro-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .registro-header-center {
        order: -1;
        flex: 100%;
    }

    .registro-table {
        font-size: 0.78rem;
    }

    .col-denom, .col-parr, .col-cat {
        display: none;
    }
}

/* Thumbnail foto nel registro */
.col-foto {
    width: 40px;
    padding: 2px 4px !important;
}
.registro-thumb {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 4px;
    vertical-align: middle;
}
