@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Punchier, Modern Enterprise Color Palette */
    --color-primary: #4f46e5;
    --color-primary-hover: #4338ca;
    --color-secondary: #0ea5e9;

    --color-surface: #ffffff;
    --color-background: #f1f5f9;
    --color-border: #e2e8f0;

    --color-text-main: #0f172a;
    --color-text-muted: #64748b;

    /* Status Colors */
    --status-pending: #f59e0b;
    --status-pending-bg: #fef3c7;
    --status-pending-text: #b45309;

    --status-progress: #3b82f6;
    --status-progress-bg: #eff6ff;
    --status-progress-text: #1e3a8a;

    --status-resolved: #10b981;
    --status-resolved-bg: #ecfdf5;
    --status-resolved-text: #065f46;
    --status-critical: #ef4444;

    /* Softer rounded Layout constraints */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    /* Rich, layered shadows for depth */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-nav: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --color-background: #121212;
    --color-surface: #1e1e1e;
    --color-border: #333333;
    --color-primary: #8b5cf6;
    --color-primary-hover: #7c3aed;
    --color-text-main: #f5f5f5;
    --color-text-muted: #a3a3a3;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-nav: 0 1px 3px 0 rgba(0, 0, 0, 0.8);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.5);

    /* Dark Mode Status Adjustments for Contrast */
    --status-pending-bg: #451a03;
    --status-pending-text: #fcd34d;

    --status-progress-bg: #1e3a8a;
    --status-progress-text: #bfdbfe;

    --status-resolved-bg: #064e3b;
    --status-resolved-text: #6ee7b7;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--color-background);
    color: var(--color-text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
    padding-bottom: 5rem;
}

@keyframes crazyLogoEntrance {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-720deg);
    }

    50% {
        opacity: 1;
        transform: scale(1.4) rotate(20deg);
    }

    75% {
        transform: scale(0.8) rotate(-10deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
    }
}

.animate-logo {
    animation: crazyLogoEntrance 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    transform-origin: center;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    color: var(--color-text-main);
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Utilities */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    overflow-x: hidden;
    /* Prevent horizontal overflow */
}

@media (max-width: 600px) {
    .container {
        padding: 0 1rem;
    }
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--color-text-main);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background-color: var(--color-surface);
    color: var(--color-text-main);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    font-family: inherit;
    box-shadow: var(--shadow-sm);
}

.btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    text-decoration: none;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--color-border);
    color: var(--color-text-main);
}

.btn-outline:hover {
    background-color: var(--color-background);
    border-color: var(--color-text-main);
    color: var(--color-text-main);
    text-decoration: none;
}

/* Nav */
.navbar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-nav);
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    overflow: visible;
    /* Allow dropdowns to overflow */
}

@media (max-width: 600px) {
    .navbar .container {
        padding: 0 0.75rem;
    }
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .nav-brand {
        font-size: 1.1rem;
        /* Slightly smaller for mobile room */
    }
}

.nav-brand-logo {
    width: 24px;
    height: 24px;
}

.nav-brand:hover {
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

@media (max-width: 600px) {
    .nav-links {
        gap: 0.4rem;
    }

    /* Hide non-essential top-level links on mobile navbar, but KEEP map.html */
    .nav-links>a:not([href="map.html"]) {
        display: none;
    }

    /* Ensure the Public Map link is visible but has smaller font if needed */
    .nav-links>a[href="map.html"] {
        display: block;
        font-size: 0.8rem;
        white-space: nowrap;
    }
}

.nav-links a {
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 0.9rem;
}

.nav-links a:hover {
    color: var(--color-text-main);
    text-decoration: none;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.theme-toggle:hover {
    background: var(--color-border);
    color: var(--color-text-main);
}

.profile-dropdown-container {
    position: relative;
    display: flex;
    align-items: center;
    padding-right: 14px;
    /* Space for the dropdown arrow */
}

.profile-avatar {
    background: var(--color-primary);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
    position: relative;
}

.profile-avatar::after {
    content: "";
    position: absolute;
    right: -14px;
    top: 50%;
    transform: translateY(-60%) rotate(45deg);
    width: 6px;
    height: 6px;
    border-bottom: 2px solid var(--color-text-muted);
    border-right: 2px solid var(--color-text-muted);
    transition: border-color 0.2s;
}

.profile-avatar:hover {
    transform: scale(1.05);
}

.profile-avatar:hover::after {
    border-color: var(--color-text-main);
}

.profile-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    min-width: 150px;
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

@media (max-width: 600px) {
    .profile-dropdown-menu {
        right: 0;
        min-width: 160px;
        transform: translateY(0);
        /* Better placement on mobile */
    }
}

.profile-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}



.profile-dropdown-menu a {
    padding: 0.5rem 1rem;
    color: var(--color-text-main);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.2s;
}

.profile-dropdown-menu a:hover {
    background: var(--color-background);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-pending {
    background: var(--status-pending-bg);
    color: var(--status-pending-text);
}

.badge-progress {
    background: var(--status-progress-bg);
    color: var(--status-progress-text);
}

.badge-resolved {
    background: var(--status-resolved-bg);
    color: var(--status-resolved-text);
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Footer Styling */
.site-footer {
    text-align: center;
    padding: 1.5rem 1rem;
    margin-top: auto;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    background-color: var(--color-border);
    /* Distinct background */
    border-top: 2px solid #cbd5e1;
    width: 100%;
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--color-surface);
    width: 90%;
    max-width: 650px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.2s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-muted);
    line-height: 1;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.modal-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.modal-value {
    font-size: 0.95rem;
    color: var(--color-text-main);
    word-break: break-word;
}

.modal-gallery {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.modal-gallery img {
    height: 150px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    object-fit: cover;
}

/* Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--color-border);
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    margin: 0 auto 0.5rem;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}