/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --background-color: #ecf0f1;
    --text-color: #2c3e50;
    --border-color: #bdc3c7;
    --white: #ffffff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
    background-color: var(--white);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.main-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: 2rem;
    box-shadow: var(--shadow);
    position: relative; /* allow absolute positioning of header controls */
}

/* Header layout for title, menu, and section name */
.main-header .header-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
}

.main-header .header-left {
    display: flex;
    align-items: center;
}

.main-header .header-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.main-header h1 {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
}

.site-title-primary {
    font-size: 2.5rem;
    line-height: 1;
}

.site-title-secondary {
    font-size: 1.4rem;
    line-height: 1;
    letter-spacing: 6px;
}

.main-header .section-link {
    position: absolute;
    right: 2rem;
    bottom: 8px; /* anchor at bottom of header */
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.2;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow);
}

.main-header .section-link:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Subheader and Navigation */
.subheader {
    background-color: var(--white);
    padding: 1rem 2rem;
    border-bottom: 2px solid var(--border-color);
}

.nav-menu {
    display: flex;
    justify-content: flex-start;
}

/* When the nav-menu is placed inside the header */
.nav-menu.in-header {
    justify-content: flex-start;
    position: absolute;
    left: 2rem;
    bottom: 8px; /* anchor at bottom of header */
}

/* Position Code Enforcement dropdown at bottom-right of header */
.main-header .header-right .dropdown {
    position: absolute;
    right: 2rem;
    bottom: 8px;
}

/* Make Services Menu smaller when in header */
.nav-menu.in-header .dropdown-btn {
    padding: 8px 12px;
    font-size: 14px;
}

/* Make Code Enforcement dropdown button same size as Services menu */
.main-header .header-right .dropdown .dropdown-btn {
    padding: 8px 12px;
    font-size: 14px;
}

/* Dropdown Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    background-color: var(--secondary-color);
    color: var(--white);
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.dropdown-btn:hover {
    background-color: #2980b9;
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.dropdown-btn .arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.dropdown-btn.active .arrow {
    transform: rotate(180deg);
}

.dropdown .submenu {
    border-top: 1px solid var(--border-color);
    margin: 10px 12px 0;
    padding-top: 10px;
}

.submenu-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.submenu-toggle .arrow {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.3s ease;
}

.submenu-toggle.active .arrow {
    transform: rotate(180deg);
}

.submenu-content {
    display: none;
    margin-top: 8px;
}

.submenu-content.show {
    display: block;
}

.submenu-content .menu-button {
    margin: 6px 12px 0 24px;
    width: calc(100% - 36px);
    font-size: 15px;
    padding: 10px 16px;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--white);
    min-width: 280px;
    box-shadow: var(--shadow-hover);
    z-index: 1000;
    border-radius: 10px;
    margin-top: 8px;
    border: 1px solid var(--border-color);
    padding: 10px 0;
}

.dropdown-content.show {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    display: none; /* replaced by menu-button */
}

.dropdown-item:last-child {
    display: none;
}

.dropdown-item:hover {
    display: none;
}

.dropdown-item.active {
    display: none;
}

/* Raised menu buttons inside dropdown */
.menu-button {
    background-color: var(--white);
    color: var(--primary-color);
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 600;
    border: 1px solid var(--border-color);
    cursor: pointer;
    border-radius: 8px;
    display: block;
    width: calc(100% - 24px);
    margin: 8px 12px;
    text-align: left;
    box-shadow: var(--shadow);
    transition: all 0.25s ease;

    text-decoration: none;   /* 🔥 ADD THIS */
    color: var(--primary-color); /* 🔥 FORCE COLOR */
}

.menu-button:hover {
    background-color: var(--secondary-color);
    color: var(--white);
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.menu-button:active {
    transform: translateY(0);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
}

.welcome-section, .page-section {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 0;
}

.welcome-section h2, .page-section h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.welcome-section p, .page-section > p {
    font-size: 1.1rem;
    color: #7f8c8d;
    margin-bottom: 2rem;
}

/* Info Cards */
.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.card {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.dashboard-card-container {
    padding: 1.75rem;
}


.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.dashboard-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 1.75rem 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    background-color: var(--white);
    text-decoration: none;
    color: var(--text-color);
    min-height: 200px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    text-align: center;
}

.dashboard-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}

.dashboard-card:focus {
    outline: 3px solid rgba(52, 152, 219, 0.3);
    outline-offset: 4px;
}


.dashboard-card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.dashboard-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.dashboard-card-count {
    font-size: 2.6rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.2;
}

.dashboard-card-meta {
    font-size: 0.95rem;
    color: #7f8c8d;
}

.dashboard-card-cta {
    margin-top: 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--secondary-color);
}

@media (max-width: 768px) {
    .dashboard-card-container {
        padding: 1.25rem;
    }

    .dashboard-card {
        min-height: 170px;
    }

    .dashboard-card-count {
        font-size: 2.1rem;
    }
}

.card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.card p {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
}

.btn-primary {
    background-color: var(--secondary-color);
    color: var(--white);
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    background-color: #2980b9;
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

/* Table styles */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table th, .data-table td {
    font-size: 0.95rem;
}

.data-table tbody tr:hover {
    background-color: #f7f9fb;
}

/* Inline search results list */
.inline-results {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    max-height: 220px;
    overflow-y: auto;
}
.inline-results .result-item {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}
.inline-results .result-item:last-child {
    border-bottom: none;
}
.inline-results .result-item:hover {
    background-color: #f7f9fb;
}

/* Smaller buttons inside tables to avoid overlap */
.data-table .btn-primary {
    padding: 6px 12px;
    font-size: 14px;
    line-height: 1.2;
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-buttons .btn-primary {
    flex: 1 1 100px;
    text-align: center;
}

/* Footer */
.footer {
    background-color: var(--primary-color);
    color: var(--white);
    text-align: center;
    padding: 1.5rem;
    margin-top: auto;
}

.footer p {
    font-size: 0.9rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 16px;
}
.modal {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-hover);
    width: 100%;
    max-width: 540px;
    padding: 16px;
}
.modal-header {
    margin-bottom: 8px;
}
.modal-body {
    margin: 8px 0 12px;
}
.modal-footer {
    margin-top: 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-header h1 {
        font-size: 1.8rem;
    }
    .main-header .header-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .container {
        box-shadow: none;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .info-cards {
        grid-template-columns: 1fr;
    }
    
    .dropdown-content {
        min-width: 200px;
    }
}

@media (max-width: 480px) {
    .main-header h1 {
        font-size: 1.5rem;
        letter-spacing: 1px;
    }
    
    .subheader {
        padding: 1rem;
    }
    
    .dropdown-btn {
        padding: 10px 16px;
        font-size: 14px;
    }
}

/* Utility: hide on small screens */
@media (max-width: 768px) {
    .hide-sm {
        display: none !important;
    }
}
