/* --- Reset & Layout --- */
.directory-container { padding: 30px 0; }
.directory-box { 
    background: #fff; 
    border-radius: 16px; 
    border: 1px solid #dee2e6; 
    padding: 20px; 
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* Paste the CSS above here */
.ps-grid,
.bod-grid,
.util-grid,
.member-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
}

.ps-card,
.bod-card,
.util-card,
.member-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgb(0 0 0 / 0.1);
    width: 280px;
    padding: 1.5rem 1.5rem 2rem;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: default;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ps-card:hover,
.bod-card:hover,
.util-card:hover,
.member-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgb(0 0 0 / 0.15);
}

.ps-photo,
.bod-photo,
.util-photo,
.member-photo {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 0px solid #0078d7;
    box-shadow: 0 4px 10px rgb(0 0 0 / 0.1);
}

.ps-name,
.bod-name,
.util-name,
.member-name {
    font-weight: 700;
    font-size: 1.25rem;
    margin-top: 1rem;
    color: #222;
    text-decoration: underline;
}

.ps-title,
.bod-title,
.util-title,
.member-title {
    font-weight: 500;
    font-size: 1rem;
    color: #555;
    margin-top: 0.25rem;
}

.ps-contacts,
.bod-contacts,
.util-contacts,
.member-contacts {
    margin-top: auto;
    display: flex;
    gap: 1.25rem;
    justify-content: center;
}

.ps-contacts a,
.bod-contacts a,
.util-contacts a,
.member-contacts a {
    color: #0078d7;
    text-decoration: none;
    font-size: 1.25rem;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ps-contacts a:hover,
.bod-contacts a:hover,
.util-contacts a:hover,
.member-contacts a:hover,
.ps-contacts a:focus,
.bod-contacts a:focus,
.util-contacts a: focus,
.member-contacts a: focus{
    color: #005a9e;
}

.ps-contacts svg,
.bod-contacts svg,
.util-contacts svg,
.member-contacts svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.ps-phone,
.bod-phone,
.member-phone,
.util-phone {
    font-size: 1rem;
    margin-top: 0.5rem;
    color: #444;
    font-weight: 500;
}

.member-position {
    font-weight: 500;
    font-size: 1rem;
    color: #555;
    margin: 0.25rem 0 0.75rem;
}

.member-term,
.member-unit {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.25rem;
}

/* --- Centered Header Section --- */
.directory-header.centered {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.directory-header h3 {
    margin: 0 0 15px 0;
    font-weight: 700;
    color: #043270;
    font-size: 2rem;
}
.header-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* Align Title (Left) and Search (Right) */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    width: 100%;
}

.title-group {
    display: flex;
    align-items: center;
    gap: 25px;
}

.table-controls h3 { 
    margin: 0; 
    font-weight: 800; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    color: #1a202c;
    font-size: 1.3rem;
}

/* --- Action Buttons --- */
.btn-modern {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: none !important;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
}
.btn-owner { background: #ed8936; color: #fff !important; }
.btn-owner:hover { background: #dd6b20; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(237, 137, 54, 0.3); }
.btn-board { background: #4299e1; color: #fff !important; }
.btn-board:hover { background: #3182ce; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3); }

/* --- Search Box (Right Side) --- */
#search-container .dataTables_filter {
    margin: 0;
}

#search-container .dataTables_filter input {
    width: 300px !important;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

#search-container .dataTables_filter input:focus {
    border-color: #043270;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

#directory thead th { 
    background-color: #043270 !important; 
    color: #ffffff !important; 
    font-weight: 800 !important; 
    text-transform: uppercase; 
    font-size: 0.75rem; 
    padding: 15px;
    border: none !important;
}

/* Force DataTables Sorting Arrows to Bold White */
table.dataTable thead .sorting:before,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_desc:before,
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
    color: #ffffff !important;
    opacity: 1 !important;
    font-weight: 900 !important;
}

#directory tbody td { 
    padding: 12px 15px; 
    vertical-align: middle; 
    font-size: 0.9rem;
    color: #2d3748;
    border-bottom: 1px solid #f0f0f0;
}

/* Interactive Links */
.dir-link { 
    color: #043270; 
    font-weight: 600; 
    text-decoration: none !important; 
    display: inline-flex; 
    align-items: center; 
    gap: 6px; 
}
.dir-link:hover { color: #2c5282; }

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .ps-grid,
    .bod-grid,
    .util-grid,
    .member-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 2rem;
        justify-content: center;
        margin-bottom: 40px;
    }
}

.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; width: 100%; }
.dataTables_filter { text-align: left !important; margin-bottom: 0 !important; float: none !important; }
.dataTables_filter input { width: 300px; transition: width 0.2s ease; }
.dataTables_filter input:focus { width: 350px; }
        
.btn-excel-export {
    display: inline-flex; align-items: center; padding: 0.6rem 1.2rem;
    background-color: #107C41; color: white !important; border-radius: 8px;
    font-size: 0.9rem; font-weight: 600; text-decoration: none !important;
    transition: all 0.2s ease; box-shadow: 0 1px 2px rgba(0,0,0,0.05); height: 42px;
}
.btn-excel-export:hover { background-color: #0E6C38; transform: translateY(-1px); box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.btn-excel-export i { margin-right: 8px; font-size: 1.1rem; }
#directory tbody tr { cursor: pointer; transition: background-color 0.15s; }
#directory tbody tr:hover { background-color: #F8FAFC !important; }

.swal-details-container { text-align: left; max-height: 60vh; overflow-y: auto; padding: 10px; }
.details-grid { display: grid; grid-template-columns: 140px 1fr; gap: 10px; border-top: 1px solid #EDF2F7; padding-top: 10px; }
.details-item { padding: 8px 0; border-bottom: 1px solid #F7FAFC; display: contents; }
.details-label { font-weight: 700; color: #4A5568; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.025em; }
.details-value { color: #2D3748; font-size: 0.95rem; }
.details-value a { color: #3B82F6; text-decoration: none; font-weight: 500; }
.details-value a:hover { text-decoration: underline; }

.directory-box .dataTables_wrapper .dataTables_paginate { margin-top: 1.5rem; text-align: center; float: none; display: flex; justify-content: center; }
.directory-box .dataTables_wrapper .dataTables_info { margin-top: 1rem; text-align: center; float: none; color: #718096; font-size: 0.875rem; }

/* --- HOA Directory Specific Overrides --- */
.ps-grid {
    display: grid !important;
    /* Reduced min-width to 160px to prevent overlap and decrease size */
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
    gap: 1.25rem !important;
    width: 100% !important;
    justify-content: center !important;
}

.ps-card {
    background: #fff !important;
    border-radius: 10px !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 12px rgb(0 0 0 / 0.08) !important;
    padding: 1.2rem 0.5rem !important;
    text-align: center !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    cursor: pointer !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 0 !important; 
    position: relative !important;
    float: none !important; /* Prevents overlap from old float layouts */
}

.ps-card:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 20px rgb(0 0 0 / 0.12) !important;
    border-color: #cbd5e0 !important;
}

.unit-display {
    font-weight: 800 !important;
    color: #2b6cb0 !important; /* Adjust to your $color1 if needed */
    font-size: 1rem !important;
    margin-bottom: 0.3rem !important;
    width: 100% !important;
}

.name-display {
    font-size: 0.85rem !important;
    color: #2d3748 !important;
    font-weight: 600 !important;
    width: 100% !important;
    white-space: nowrap !important; /* Forces name onto one line */
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    padding: 0 5px !important;
}

        .building-section { margin-bottom: 3rem; width: 100%; }
        .building-header { 
            border-bottom: 2px solid #e2e8f0; 
            margin-bottom: 1.5rem; 
            padding-bottom: 0.5rem;
            color: #2d3748;
            font-weight: 700;
            text-align: left;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .ps-grid {
            display: grid;
            /* Reduced min-width to 150px to ensure cards are smaller and don't overlap */
            grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
            gap: 1rem;
            width: 100%;
        }

        .ps-card {
            cursor: pointer;
            transition: transform 0.1s, box-shadow 0.1s;
            padding: 1.2rem 0.8rem !important;
            text-align: center !important; /* Centered content */
            background: #fff;
            border: 1px solid #e2e8f0;
            border-radius: 10px;
            box-sizing: border-box;
            display: flex;
            flex-direction: column;
            align-items: center; /* Centered content */
            justify-content: center;
            min-width: 0;
            max-width: 150px;
            height: 100%;
        }
        .ps-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.08);
            border-color: #cbd5e0;
        }
        .unit-display {
            font-weight: 800;
            color: var(--color1, #2b6cb0);
            font-size: 1rem;
            margin-bottom: 0.4rem;
        }
        .name-display {
            font-size: 0.9rem;
            color: #2d3748;
            font-weight: 600;
            line-height: 1.3;
            word-wrap: break-word;
            width: 100%;
        }

        .swal2-popup { font-size: 0.9rem !important; border-radius: 12px !important; }
        .swal-avatar { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; margin-bottom: 1rem; border: 3px solid #edf2f7; }
