/* Enhanced Modern Main Styles - Login Page Theme for Government Use */

:root {
    /* Login page inspired teal color palette */
    --primary-teal: #008E76;
    --primary-teal-dark: #00705E;
    --primary-teal-light: #00A68A;

    /* Supporting colors */
    --gca-blue: #2D3F94;
    --gca-grey: #D0D0D0;
    --gca-light-grey: #F3F5F7;
    --gca-black: #1a1a1a;
    --gca-yellow: #FDE850;
    --gca-green: #32AD49;
    --gca-orange: #ef9424;
    --gca-turquoise: #009bc2;
    --gca-purple: #876ba1;

    /* Enhanced shadows with teal tint */
    --shadow-sm: 0 2px 4px rgba(0, 142, 118, 0.05);
    --shadow-md: 0 4px 8px rgba(0, 142, 118, 0.08);
    --shadow-lg: 0 8px 16px rgba(0, 142, 118, 0.12);
    --shadow-xl: 0 12px 24px rgba(0, 142, 118, 0.15);

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.4s ease;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background: #fcfcfc;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

/* Halftone background overlay - matching login page */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/static/gca/img/halftone.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.06;
    pointer-events: none;
    z-index: 0;
}

/* Links */
a {
    color: var(--primary-teal);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-teal-dark);
    text-decoration: underline;
}

a:visited {
    color: var(--gca-purple);
}

a:focus {
    outline: 2px solid var(--primary-teal);
    outline-offset: 2px;
}

/* Main content area */
#main {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 80px);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

/* Map container */
#map {
    display: flex;
    width: 100vw;
    height: 100%;
    flex: 1;
    position: relative;
    z-index: 1;
    background: #e5e9ed;
}

/* Enhanced spinner/loading indicator */
#spinner {
    z-index: 10000;
    position: absolute;
    top: 50%;
    left: 50%;
    filter: drop-shadow(0 0 2px white);
    -webkit-filter: drop-shadow(0 0 2px white);
}

#spinner .fa {
    font-size: 48px;
    color: var(--primary-teal);
    background: var(--primary-teal);
    filter: drop-shadow(0 0 2px white);
    -webkit-filter: drop-shadow(0 0 2px white);
    mask: url("../img/svg/loading.svg");
    -webkit-mask-image: url("../img/svg/loading.svg");
    animation: spin 1s ease-in-out infinite;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Enhanced info overlay - matching login page card style */
#info-overlay {
    display: none;
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 100001;
    backdrop-filter: blur(4px);
    animation: overlayFadeIn 0.3s ease;
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#info-overlay.active {
    display: block;
}

#info-overlay #info-overlay-content {
    overflow-y: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 600px;
    max-width: 92%;
    max-height: 85vh;
    padding: 36px;
    border-radius: 16px;
    background-color: #ffffff;
    transform: translate(-50%, -50%);
    box-shadow: 0 12px 40px rgba(0, 142, 118, 0.15);
    animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Custom scrollbar for overlay content */
#info-overlay #info-overlay-content::-webkit-scrollbar {
    width: 6px;
}

#info-overlay #info-overlay-content::-webkit-scrollbar-track {
    background: #F3F5F7;
    border-radius: 3px;
}

#info-overlay #info-overlay-content::-webkit-scrollbar-thumb {
    background: var(--primary-teal);
    border-radius: 3px;
}

#info-overlay #info-overlay-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-teal-dark);
}

#info-overlay #info-overlay-content > h1 {
    text-align: center;
    margin: 0 0 24px 0;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--primary-teal);
    color: var(--primary-teal);
    font-size: 26px;
    font-weight: 700;
}

#info-overlay #info-overlay-close {
    position: absolute;
    right: 22px;
    top: 22px;
    cursor: pointer;
    font-size: 34px;
    color: #999;
    line-height: 1;
    transition: all var(--transition-fast);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

#info-overlay #info-overlay-close:hover {
    color: #333;
    background: #F3F5F7;
    transform: rotate(90deg);
}

#info-overlay #info-overlay-data,
#info-overlay #info-overlay-img {
    overflow-y: auto;
    margin: 16px 0;
}

#info-overlay #info-overlay-img {
    text-align: center;
    color: #999;
}

#info-overlay #info-overlay-img img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: var(--shadow-md);
}

#info-overlay #info-overlay-data,
#info-overlay #info-overlay-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin: 18px 0;
}

#info-overlay #info-overlay-form {
    align-items: center;
}

#info-overlay #info-overlay-data p,
#info-overlay #info-overlay-form p {
    margin: 0;
    padding: 10px;
    font-size: 13px;
}

#info-overlay #info-overlay-data p:nth-child(odd),
#info-overlay #info-overlay-form p:nth-child(odd) {
    font-weight: 700;
    color: #555;
    background: #F3F5F7;
    border-radius: 8px;
}

#info-overlay #info-overlay-data p:nth-child(even),
#info-overlay #info-overlay-form p:nth-child(even) {
    color: #333;
}

#info-overlay #info-overlay-data p.legend-bar,
#right-panel #right-panel-indicator-info p.legend-bar {
    margin-right: 8px;
}

#info-overlay #info-overlay-data p.legend-bar img,
#right-panel #right-panel-indicator-info p.legend-bar img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: var(--shadow-sm);
}

/* Form inputs in overlay - matching login page style */
#info-overlay #info-overlay-form input[type="text"],
#info-overlay #info-overlay-form input[type="email"],
#info-overlay #info-overlay-form select,
#info-overlay #info-overlay-form textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid transparent;
    background: #F3F5F7;
    border-radius: 12px;
    font-size: 14px;
    transition: all var(--transition-fast);
}

#info-overlay #info-overlay-form input:focus,
#info-overlay #info-overlay-form select:focus,
#info-overlay #info-overlay-form textarea:focus {
    outline: none;
    border-color: var(--primary-teal);
    background: #ffffff;
}

#info-overlay #info-overlay-form button {
    padding: 14px 24px;
    background: var(--primary-teal);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#info-overlay #info-overlay-form button:hover {
    background: var(--primary-teal-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

#info-overlay #info-overlay-form button:active {
    transform: translateY(0);
}

/* Utility classes */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.slide-in-left {
    animation: slideInLeft 0.4s ease;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.4s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 3px solid var(--primary-teal);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    #header,
    #left-panel,
    #right-panel #button-toggle-right-panel {
        display: none !important;
    }

    #map {
        height: 100vh !important;
    }

    #right-panel {
        box-shadow: none !important;
    }

    body::before {
        display: none !important;
    }
}

/* Responsive breakpoints */
@media (max-width: 1200px) {
    #main {
        height: calc(100vh - 75px);
    }
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    #main {
        flex-direction: column;
        height: calc(100vh - 110px);
    }

    #info-overlay #info-overlay-content {
        width: 96%;
        padding: 28px;
    }

    #info-overlay #info-overlay-content > h1 {
        font-size: 22px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    body {
        background: #ffffff;
    }

    body::before {
        display: none;
    }

    a {
        text-decoration: underline;
    }

    #header {
        border-bottom: 3px solid #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
