/**
 * ============================================================================
 * UNIFIED DIRECTORY STYLES
 * ============================================================================
 * 
 * File Path:        public/css/modules/unified-directory.css
 * Version:          1.5.0
 * Created:          Sunday, December 08, 2025, 18:30 AEST
 * Updated:          Friday, December 13, 2025, 11:15 AEST
 * 
 * Purpose:
 *   Shared styles for all directory screens (residents, lots, contractors).
 *   Works with BaseDirectoryManager and specific directory managers.
 * 
 * Version History:
 *   1.5.0 (2025-12-13) - FILTER UX: Clear filters button, Text-based status badges (EVAC/MED/PET/SA)
 *                        Removed dots from animal badges, improved clickable states
 *   1.4.0 (2025-12-13) - ANIMAL BADGES: Added pet (orange) and assistance animal (green) indicators
 *                        Clickable status badges with hover and active states
 *                        Emergency evacuation planning support
 *   1.3.0 (2025-12-13) - LOT BADGES: Added assistance/medical indicators
 *                        Pink/blue/split badges for lot numbers
 *                        Status indicator badges in filter bar
 *   1.2.0 (2025-12-12) - SEARCH BAR FIX: Added width: 100%; max-width: 100%;
 *                        All directories now have consistent full-width search
 *   1.1.0 (2024-12-11) - Added badge-building (teal) and badge-appliances (purple)
 *   1.0.0 (2024-12-08) - Initial release
 * 
 * ============================================================================
 */

/* ========================================================================
   COMPACT DASHBOARD HEADER
   ======================================================================== */

.dashboard-header {
    background: white;
    padding: 15px 25px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.back-btn {
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.back-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.3);
}

.header-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 15px;
}

.page-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #1F2937;
}

.building-name {
    font-size: 16px;
    color: #6B7280;
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.add-btn {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.add-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.header-user {
    text-align: right;
}

.user-display {
    font-size: 14px;
    color: #6B7280;
}

/* ========================================================================
   SEARCH BAR
   ======================================================================== */

.search-container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 100%;
}

.search-container input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.search-container input:focus {
    outline: none;
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.search-container button {
    background: #EF4444;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.search-container button:hover {
    background: #DC2626;
}

.clear-filters-btn {
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%) !important;
    margin-left: 10px;
}

.clear-filters-btn:hover {
    background: linear-gradient(135deg, #7C3AED 0%, #6D28D9 100%) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.3);
}

.results-counter {
    font-size: 14px;
    color: #6B7280;
    white-space: nowrap;
}

/* ========================================================================
   TAB NAVIGATION
   ======================================================================== */

.tabs-container {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tab-btn {
    background: #F3F4F6;
    color: #6B7280;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    background: #E5E7EB;
}

.tab-btn.active {
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    color: white;
}

.tab-btn .badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
}

.tab-btn.active .badge {
    background: rgba(255, 255, 255, 0.3);
}

/* ========================================================================
   DATA TABLE
   ======================================================================== */

.table-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 350px);
}

.directory-table {
    width: 100%;
    border-collapse: collapse;
    display: table;
    background: white;
    table-layout: fixed;
}

.directory-table thead {
    display: table-header-group;
    background: linear-gradient(135deg, #F8FAFC 0%, #E2E8F0 100%);
    border-bottom: 2px solid #CBD5E1;
    position: sticky;
    top: 0;
    z-index: 10;
}

.directory-table th {
    display: table-cell;
    padding: 14px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    white-space: nowrap;
    border-right: 1px solid #E2E8F0;
    vertical-align: middle;
    background: linear-gradient(135deg, #F8FAFC 0%, #E2E8F0 100%);
}

.directory-table th:last-child {
    border-right: none;
}

.directory-table tbody {
    display: table-row-group;
}

.directory-table tbody tr {
    display: table-row;
    border-bottom: 1px solid #F1F5F9;
    transition: all 0.2s ease;
    cursor: pointer;
}

.directory-table tbody tr:hover {
    background: #F8FAFC;
}

.directory-table td {
    display: table-cell;
    padding: 12px;
    font-size: 0.875rem;
    color: #374151;
    border-right: 1px solid #F1F5F9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.directory-table td:last-child {
    border-right: none;
}

/* Highlight animation for newly added items */
.directory-row.highlight-new {
    animation: highlightPulse 2s ease-in-out;
}

@keyframes highlightPulse {
    0%, 100% { background: transparent; }
    50% { background: #FEF3C7; }
}

/* ========================================================================
   BADGES
   ======================================================================== */

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Role badges */
.badge-owner { background: #D1FAE5; color: #065F46; border: 1px solid #10B981; }
.badge-tenant { background: #DBEAFE; color: #1E40AF; border: 1px solid #3B82F6; }
.badge-committee { background: #EDE9FE; color: #5B21B6; border: 1px solid #8B5CF6; }
.badge-manager { background: #FEF3C7; color: #92400E; border: 1px solid #F59E0B; }
.badge-securitymanager { background: #FEE2E2; color: #991B1B; border: 1px solid #EF4444; }

/* Lot badges */
.badge-apartment { background: #DBEAFE; color: #1E40AF; border: 1px solid #3B82F6; }
.badge-penthouse { background: #FCE7F3; color: #9F1239; border: 1px solid #F472B6; }
.badge-studio { background: #E0E7FF; color: #3730A3; border: 1px solid #818CF8; }
.badge-townhouse { background: #D1FAE5; color: #065F46; border: 1px solid #10B981; }

.badge-occupied { background: #D1FAE5; color: #065F46; border: 1px solid #10B981; }
.badge-vacant { background: #F3F4F6; color: #374151; border: 1px solid #9CA3AF; }
.badge-leased { background: #DBEAFE; color: #1E40AF; border: 1px solid #3B82F6; }
.badge-renovation { background: #FEF3C7; color: #92400E; border: 1px solid #F59E0B; }

/* Contractor trade badges */
.badge-building { background: #CCFBF1; color: #115E59; border: 1px solid #14B8A6; }  /* Teal - NEW v1.1.0 */
.badge-plumbing { background: #DBEAFE; color: #1E40AF; border: 1px solid #3B82F6; }
.badge-electrical { background: #FEF3C7; color: #92400E; border: 1px solid #F59E0B; }
.badge-hvac { background: #E0E7FF; color: #3730A3; border: 1px solid #818CF8; }
.badge-carpentry { background: #FED7AA; color: #92400E; border: 1px solid #FB923C; }
.badge-painting { background: #FCE7F3; color: #9F1239; border: 1px solid #F472B6; }
.badge-cleaning { background: #D1FAE5; color: #065F46; border: 1px solid #10B981; }
.badge-appliances { background: #E9D5FF; color: #6B21A8; border: 1px solid #A855F7; }  /* Purple - NEW v1.1.0 */
.badge-landscaping { background: #DCFCE7; color: #166534; border: 1px solid #22C55E; }
.badge-general { background: #F3F4F6; color: #374151; border: 1px solid #9CA3AF; }
.badge-other { background: #F3F4F6; color: #374151; }  /* No border for "Other" */

/* Contractor status badges */
.badge-approved { background: #D1FAE5; color: #065F46; border: 1px solid #10B981; }
.badge-pending { background: #FEF3C7; color: #92400E; border: 1px solid #F59E0B; }
.badge-suspended { background: #FEE2E2; color: #991B1B; border: 1px solid #EF4444; }
.badge-rejected { background: #FEE2E2; color: #DC2626; border: 1px solid #EF4444; }

/* ========================================================================
   LOT BADGES (Assistance/Medical Indicators)
   ======================================================================== */

.lot-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

.lot-badge-assistance {
    background-color: #ffc0cb; /* Pale pastel pink */
}

.lot-badge-medical {
    background-color: #b0e0e6; /* Pale powder blue */
}

.lot-badge-split {
    background: linear-gradient(90deg, #ffc0cb 50%, #b0e0e6 50%);
}

.lot-badge-pet {
    background-color: #ffd4a3; /* Pale peach orange */
}

.lot-badge-assistance-animal {
    background-color: #c3e6cb; /* Pale mint green */
}

/* Empty bubbles for animal indicators (no text/dots) */
.lot-badge-empty {
    padding: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    min-width: 16px;
    vertical-align: middle;
}

/* ========================================================================
   STATUS INDICATORS (Filter Bar)
   ======================================================================== */

.status-indicators {
    display: inline-block;
    margin-left: 20px;
}

.status-label {
    margin-right: 8px;
    color: #666;
    font-size: 14px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    margin-right: 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.status-badge .badge-text {
    font-weight: 700;
}

.status-badge .badge-count {
    font-weight: 500;
    opacity: 0.8;
}

.badge-assistance {
    background-color: #ffc0cb; /* Pale pastel pink */
}

.badge-medical {
    background-color: #b0e0e6; /* Pale powder blue */
}

.badge-pet {
    background-color: #ffd4a3; /* Pale peach orange */
}

.badge-assistance-animal {
    background-color: #c3e6cb; /* Pale mint green */
}

/* Active/clickable state for status badges */
.status-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.status-badge-active {
    box-shadow: 0 0 0 3px rgba(0,0,0,0.2);
    transform: scale(1.15);
    font-weight: 700;
}

/* ========================================================================
   DETAIL MODAL
   ======================================================================== */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    z-index: 100000;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #e5e7eb;
    background: linear-gradient(135deg, #F8FAFC 0%, #E2E8F0 100%);
    position: sticky;
    top: 0;
    z-index: 1;
}

.modal-header h2 {
    margin: 0;
    font-size: 22px;
    color: #1f2937;
    flex: 1;
}

.modal-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.edit-btn, .delete-btn {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.delete-btn {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
}

.delete-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

.modal-body {
    padding: 25px;
}

/* Detail sections */
.detail-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f3f4f6;
}

.detail-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.detail-section h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #4F46E5;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px 20px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 14px;
    color: #1f2937;
    font-weight: 500;
}

/* ========================================================================
   LOADING STATE
   ======================================================================== */

.loading-state {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

@media (max-width: 768px) {
    .dashboard-header {
        flex-wrap: wrap;
    }
    
    .header-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .tabs-container {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
}
