/* Nursing Home News - Based on CleanKitchens Design */
/* Clean, fast, mobile-first, no dark mode needed */

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

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --danger-color: #dc3545;
    --warning-color: #f0ad4e;  /* Better contrast than #ffc107 */
    --success-color: #5cb85c;  /* Better contrast than #28a745 */
    --text-color: #333;
    --light-gray: #f8f9fa;
    --border-color: #e5e5e5;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: #fff;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    background: var(--primary-color);
    color: white;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.nav-links a:hover {
    opacity: 1;
}

/* Desktop Header Ad Banner - Right Justified Under Nav */
.desktop-header-ad {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 10px 0;
}

.header-ad-wrapper {
    display: flex;
    justify-content: flex-end;
}

.header-ad-space {
    height: 90px;
    width: 728px;
    background: #f8f9fa;
    border: 1px dashed #ccc;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 0.9rem;
}

/* Mobile Navigation */
.mobile-menu {
    width: 28px;
    height: 20px;
    position: relative;
    cursor: pointer;
    display: none;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu span {
    display: block;
    height: 3px;
    background: white;
    margin-bottom: 5px;
    border-radius: 2px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.mobile-menu span:last-child {
    margin-bottom: 0;
}

.mobile-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Menu Dropdown (based on CleanKitchens) */
.mobile-nav-menu {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: white;
    box-shadow: var(--shadow-lg);
    z-index: 99;
    border-bottom: 3px solid var(--secondary-color);
}

.mobile-nav-menu.active {
    display: block;
}

.mobile-nav-menu a {
    display: block;
    padding: 16px;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
    transition: color 0.2s ease, padding-left 0.2s ease;
}

.mobile-nav-menu a:hover {
    background: var(--light-gray);
    color: var(--secondary-color);
    padding-left: 24px;
}

.mobile-nav-menu a:last-child {
    border-bottom: none;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto 2rem;
}

/* Search Box */
.search-form {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    gap: 1rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
}

.search-button {
    padding: 0.75rem 2rem;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.search-button:hover {
    transform: translateY(-2px);
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.card-text {
    color: #666;
    line-height: 1.5;
}

.card-meta {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #666;  /* Better contrast */
}

/* Rating badge with better contrast */
.rating-badge {
    background: #ffeeda;
    color: #856404;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}

/* Facility Grid */
.facility-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

/* Facility Page Layout */
.facility-header {
    background: var(--light-gray);
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
}

.facility-title {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.facility-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 1rem;
}

.facility-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-danger {
    background: #fdecea;
    color: var(--danger-color);
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin: 2rem 0 1rem;
    overflow-x: auto;
}

.tab {
    padding: 1rem 1.5rem;
    border: none;
    background: none;
    font-size: 1rem;
    color: #666;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--primary-color);
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.tab-content {
    padding: 2rem 0;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.data-table th {
    background: var(--light-gray);
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table tr:hover {
    background: #f8f9fa;
}

/* Sticky Mobile Ad */
.sticky-mobile-bottom-ad {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: #fff;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 9999;
    padding: 8px 10px;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.sticky-ad-wrapper {
    position: relative;
    max-width: 100%;
    margin: 0 auto;
}

.sticky-ad-label {
    font-size: 9px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    margin-bottom: 4px;
}

.sticky-ad-container {
    min-height: 50px;
    max-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sticky-ad-close {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 18px;
    cursor: pointer;
    z-index: 10000;
}

/* Footer */
footer {
    background: var(--primary-color);
    color: white;
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 1rem;
}

.footer-links a {
    color: white;
    text-decoration: none;
    opacity: 0.8;
}

.footer-links a:hover {
    opacity: 1;
}

.footer-copyright {
    opacity: 0.7;
    font-size: 0.875rem;
}

/* Desktop Bottom Banner Ad */
.desktop-bottom-ad {
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 1rem 0;
}

.bottom-ad-space {
    height: 120px;
    background: #f8f9fa;
    border: 1px dashed #ccc;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 1rem;
    margin: 2rem 0;
}

/* Mobile Styles */
@media (max-width: 768px) {
    /* Hide desktop ads on mobile */
    .desktop-header-ad,
    .desktop-bottom-ad,
    .desktop-only {
        display: none;
    }
    
    /* Stack page header content on mobile */
    .page-header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        display: none;
    }
    
    .mobile-menu {
        display: block;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-input, .search-button {
        width: 100%;
    }
    
    .facility-grid {
        grid-template-columns: 1fr;
    }
    
    .tabs {
        gap: 0;
    }
    
    .tab {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .data-table {
        font-size: 0.875rem;
    }
    
    .sticky-mobile-bottom-ad {
        display: block;
    }
    
    body.has-sticky-ad {
        padding-bottom: 120px;
    }
}

/* Hide on larger screens */
@media (min-width: 769px) {
    .sticky-mobile-bottom-ad {
        display: none !important;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-muted { color: #6c757d; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* =============================================
   FACILITIES PAGE SPECIFIC STYLES
   ============================================= */

/* Desktop Layout */
.desktop-layout {
    display: flex;
    gap: 2rem;
    margin-top: 0.5rem;
}

.sidebar {
    width: 250px;
    flex-shrink: 0;
}

.main-content {
    flex: 1;
    min-width: 0;
}

/* States Grid */
.states-grid-container {
    background: var(--light-gray);
    border-radius: 8px;
    padding: 1rem;
}

/* All States Button - Full Width */
.state-grid-item.all-states {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 6px;
    margin-bottom: 1rem;
    text-decoration: none;
    font-weight: 600;
    width: 100%;
}

/* State Grid - Compact Boxes for Desktop Viewport */
.states-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(35px, 1fr));
    gap: 0.25rem;
    margin-top: 0.5rem;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.state-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.25rem 0.125rem;
    background: white;
    border-radius: 3px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.2s;
    border: 1px solid var(--border-color);
    font-size: 0.7rem;
    min-height: 42px;
    justify-content: center;
}

.state-grid-item:hover {
    background: #f0f8ff;
    border-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.state-grid-item.active {
    background: var(--secondary-color);
    color: white;
    font-weight: 600;
    border-color: var(--secondary-color);
}

.state-abbr {
    font-weight: 600;
    font-size: 0.75rem;
    line-height: 1;
}

.state-num {
    opacity: 0.7;
    font-size: 0.6rem;
    margin-top: 0.125rem;
    line-height: 1;
}

/* Page Header with Inline Ad */
.page-header {
    margin-bottom: 2rem;
}

.page-header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
}

.page-title-section {
    flex: 1;
}

.page-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.results-summary {
    color: #666;
    font-size: 1.1rem;
}

.page-header-ad {
    flex-shrink: 0;
    margin-right: 3rem;
    margin-top: 1rem;
}

.desktop-only {
    display: block;
}

/* Advertisement Labels */
.ad-label {
    font-size: 9px;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    margin-bottom: 2px;
    opacity: 0.9;
}

/* Facilities Table */
.table-wrapper {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.facilities-table {
    width: 100%;
    border-collapse: collapse;
}

.facilities-table thead {
    background: var(--light-gray);
}

.facilities-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.facilities-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.facilities-table tbody tr:hover {
    background: #f8f9fa;
}

.facility-name-cell a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
}

.facility-name-cell a:hover {
    text-decoration: underline;
}

/* Special Rating Badges */
.rating-good {
    background: #d4edda;
    color: #155724;
}

.rating-average {
    background: #fff3cd;
    color: #856404;
}

.rating-poor {
    background: #f8d7da;
    color: #721c24;
}

.rating-none {
    background: #e7e7e7;
    color: #666;
}

.rating-number {
    margin-left: 0.5rem;
}

/* Status Badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-sff {
    background: #dc3545;
    color: white;
}

.status-normal {
    background: #e7e7e7;
    color: #666;
}

/* Special Focus Row */
.sff-row {
    background: #fff5f5;
}

/* View Button */
.btn-view {
    background: var(--secondary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-view:hover {
    background: #2980b9;
}

/* Mobile Layout for Facilities */
.mobile-layout {
    display: none;
}

.mobile-header {
    padding: 1rem;
    background: var(--light-gray);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.mobile-state-select {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    margin: 1rem 0;
}

.mobile-results {
    color: #666;
    font-size: 0.9rem;
}

/* Mobile Cards */
.mobile-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.facility-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.facility-card.sff-card {
    border-left: 4px solid var(--danger-color);
    background: #fff5f5;
}

.card-facility-name {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.card-facility-name a {
    color: var(--text-color);
    text-decoration: none;
}

.card-location {
    color: #666;
    margin-bottom: 1rem;
}

.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.card-link {
    display: inline-block;
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
}

.card-link:hover {
    text-decoration: underline;
}

/* Pagination */
.pagination-wrapper {
    margin: 3rem 0;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-link {
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.2s;
}

.page-link:hover {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.page-current {
    padding: 0.5rem 1rem;
    font-weight: 600;
}

/* Responsive Design for Facilities */
@media (max-width: 768px) {
    .desktop-layout {
        display: none;
    }
    
    .desktop-table {
        display: none;
    }
    
    .mobile-layout {
        display: block;
    }
}