/* EnviroData-NM Main Stylesheet - 2025 Modern Design */

:root {
    --primary-color: #4a90a4;
    --primary-hover: #3a7a8a;
    --primary-light: #5ba3b8;
    --accent-color: #2c5f7a;
    --text-dark: #1F2937;
    --text-medium: #4B5563;
    --text-light: #6B7280;
    --bg-main: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --bg-tertiary: #F3F4F6;
    --border-color: #E5E7EB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

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

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-secondary);
    display: grid;
    grid-template-columns: 1fr minmax(300px, 350px);
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Header Styles */
header {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    position: relative;
    box-shadow: var(--shadow-md);
}

.header-banner {
    padding: clamp(1rem, 2vw, 1.5rem) clamp(1.5rem, 3vw, 2.5rem);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-image: linear-gradient(rgba(74, 144, 164, 0.85), rgba(58, 122, 138, 0.85)), url('/static/images/header-bg.jpg');
    background-size: cover;
    background-position: center;
    min-height: clamp(70px, 10vw, 90px);
    flex-wrap: wrap;
    gap: 1rem;
}

.header-banner {
    padding: clamp(1rem, 2vw, 1.5rem) clamp(1.5rem, 3vw, 2.5rem);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-image: linear-gradient(rgba(74, 144, 164, 0.3), rgba(58, 122, 138, 0.1)), url('/static/images/header-bg.jpg');
    background-size: cover;
    background-position: center;
    min-height: clamp(70px, 10vw, 90px);
    flex-wrap: wrap;
    gap: 1rem;
}

.nm-logo img {
    width: clamp(50px, 6vw, 80px);
    height: auto;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.nm-logo img:hover {
    transform: scale(1.05);
}

/* Navigation */
.main-nav {
    background-color: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    display: flex;
    padding: 0;
    flex-wrap: wrap;
    -webkit-overflow-scrolling: touch;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: clamp(12px, 2vw, 16px) clamp(20px, 3vw, 28px);
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    white-space: nowrap;
    font-size: clamp(0.875rem, 2vw, 0.9375rem);
    font-weight: 500;
    min-height: 44px;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: white;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 80%;
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    font-weight: 600;
}

/* Main Content */
main {
    padding: clamp(2rem, 5vw, 3rem);
    background-color: var(--bg-main);
    max-width: 100%;
    overflow-x: hidden;
}

.welcome-section {
    margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
    padding: clamp(1.5rem, 3vw, 2rem);
    background: linear-gradient(135deg, rgba(74, 144, 164, 0.03) 0%, rgba(91, 163, 184, 0.05) 100%);
    border-radius: var(--radius-xl);
    border-left: 4px solid var(--primary-light);
}

.welcome-section h2 {
    color: var(--primary-color);
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.welcome-section p {
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    line-height: 1.75;
    color: var(--text-medium);
    max-width: 100%;
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: clamp(1.25rem, 3vw, 1.75rem);
    margin-bottom: clamp(2rem, 6vw, 3rem);
}

.feature-card {
    height: clamp(220px, 30vw, 280px);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.feature-card:hover,
.feature-card:focus-within {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
}

@media (hover: none) {
    .feature-card:active {
        transform: translateY(-4px) scale(1.01);
        box-shadow: var(--shadow-lg);
    }
}

.feature-card a {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: white;
}

.card-content {
    background: linear-gradient(135deg, rgba(74, 144, 164, 0.2) 0%, rgba(58, 122, 138, 0.2) 100%);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s ease;
    backdrop-filter: blur(2px);
}

.feature-card:hover .card-content {
    background: linear-gradient(135deg, rgba(74, 144, 164, 0.85) 0%, rgba(58, 122, 138, 0.95) 100%);
    backdrop-filter: blur(4px);
}

.card-content h3 {
    font-size: clamp(1.5rem, 5vw, 2.25rem);
    font-weight: 700;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    text-align: center;
    padding: 0 1.5rem;
    letter-spacing: -0.02em;
    transform: translateY(0);
    transition: transform 0.4s ease;
}

.feature-card:hover .card-content h3 {
    transform: translateY(-4px);
}

/* Feature Card Backgrounds */
.explore-map {
    background: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)),
                url('/static/images/explore-map-bg.jpg');
    background-size: cover;
    background-position: center;
}

.explore-data {
    background: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)),
                url('/static/images/explore-data-bg.jpg');
    background-size: cover;
    background-position: center;
}

.manage-projects {
    background: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)),
                url('/static/images/manage-projects-bg.jpg');
    background-size: cover;
    background-position: center;
}

.get-help {
    background: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)),
                url('/static/images/get-help-bg.jpg');
    background-size: cover;
    background-position: center;
}

/* Acknowledgment Section */
.acknowledgment {
    margin-top: clamp(2.5rem, 5vw, 3.5rem);
    padding: clamp(2rem, 5vw, 3rem);
    background: var(--bg-main);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.acknowledgment h3 {
    color: var(--primary-color);
    margin-bottom: clamp(2rem, 4vw, 2.5rem);
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 600;
    text-align: center;
    line-height: 1.4;
}

.agency-logos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: clamp(2rem, 4vw, 2.5rem);
    align-items: center;
    justify-items: center;
}

.logo-item {
    transition: transform 0.3s ease;
}

.logo-item:hover {
    transform: scale(1.05);
}

.logo-item img {
    max-width: 160px;
    max-height: 100px;
    height: auto;
    width: auto;
    filter: grayscale(10%) opacity(0.9);
    transition: all 0.3s ease;
}

.logo-item img:hover {
    filter: grayscale(0%) opacity(1);
}

/* Sidebar */
.sidebar {
    background-color: var(--bg-tertiary);
    padding: clamp(1.5rem, 4vw, 2rem) clamp(1.25rem, 3vw, 1.5rem);
    border-left: 1px solid var(--border-color);
    min-width: 0;
}

.user-login,
.other-resources {
    background-color: var(--bg-main);
    padding: clamp(1.25rem, 3vw, 1.75rem);
    margin-bottom: clamp(1.25rem, 3vw, 1.5rem);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: box-shadow 0.3s ease;
}

.user-login:hover,
.other-resources:hover {
    box-shadow: var(--shadow-lg);
}

.user-login h3,
.other-resources h3 {
    color: var(--primary-color);
    margin-bottom: clamp(1rem, 2vw, 1.25rem);
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.form-group {
    margin-bottom: clamp(10px, 2vw, 12px);
}

.form-group label {
    display: block;
    margin-bottom: clamp(3px, 1vw, 5px);
    color: #555;
    font-size: clamp(0.8rem, 1.8vw, 0.9rem);
}

.required {
    color: #d9534f;
}

.form-group input {
    width: 100%;
    padding: clamp(0.625rem, 2vw, 0.875rem);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: clamp(0.9rem, 2vw, 1rem);
    min-height: 44px;
    transition: all 0.2s ease;
    background-color: var(--bg-main);
    color: var(--text-dark);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(91, 163, 184, 0.1);
}

.form-group input::placeholder {
    color: var(--text-light);
}

.btn-login {
    width: 100%;
    padding: clamp(0.75rem, 2vw, 0.875rem);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: clamp(0.9rem, 2vw, 1rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.75rem;
    min-height: 44px;
    box-shadow: var(--shadow-sm);
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary-color) 100%);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-login:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.login-links {
    list-style: none;
    margin-top: clamp(8px, 2vw, 12px);
}

.login-links li {
    margin-bottom: clamp(4px, 1vw, 6px);
}

.login-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.login-links a:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

.other-resources p {
    margin-bottom: clamp(0.75rem, 2vw, 1rem);
    line-height: 1.6;
    font-size: clamp(0.875rem, 2vw, 0.9375rem);
    color: var(--text-medium);
}

.other-resources a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.other-resources a:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

.resource-banner {
    margin: clamp(10px, 2vw, 15px) 0;
}

.resource-banner img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.resource-banner img:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

/* Footer */
footer {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, var(--text-dark) 0%, #111827 100%);
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    padding: clamp(1.5rem, 3vw, 2rem);
    font-size: 0.875rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Responsive Design */

/* High DPI / Zoom handling */
@media (min-resolution: 2dppx), (min-resolution: 192dpi) {
    body {
        /* Ensure crisp text on high DPI displays */
        -webkit-font-smoothing: subpixel-antialiased;
    }
}

/* Large screens with extreme zoom */
@media (max-width: 1400px) {
    body {
        grid-template-columns: 1fr minmax(280px, 300px);
    }
    
    .header-banner {
        padding: min(1.5rem, 5px) clamp(0.5rem, 3vw, 30px);
    }
}

/* Tablet and smaller desktop screens */
@media (max-width: 1024px) {
    body {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr auto;
    }

    .sidebar {
        grid-row: 2;
        border-left: none;
        border-top: 1px solid #ccc;
        border-bottom: 1px solid #ccc;
        padding: 20px;
    }
    
    main {
        grid-row: 3;
    }

    .feature-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    
    .user-login,
    .other-resources {
        display: inline-block;
        width: calc(50% - 10px);
        margin-right: 20px;
        vertical-align: top;
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .user-login:last-child,
    .other-resources:last-child {
        margin-right: 0;
    }
}

/* Mobile landscape and smaller tablets */
@media (max-width: 768px) {
    html {
        font-size: 14px; /* Slightly smaller base font for mobile */
    }
    
    .header-banner {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
        gap: 0.5rem;
    }
    
    .header-banner h1 {
        max-width: 100%;
        order: 2;
    }
    
    .nm-logo {
        order: 1;
    }

    .main-nav {
        flex-direction: column;
    }

    .nav-link {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
        text-align: center;
        padding: 12px 20px;
    }
    
    .nav-link:last-child {
        border-bottom: none;
    }

    .feature-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .agency-logos {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .user-login,
    .other-resources {
        display: block;
        width: 100%;
        margin-right: 0;
        margin-bottom: 15px;
        padding: 12px;
    }
    
    .user-login h3,
    .other-resources h3 {
        margin-bottom: 8px;
        font-size: 1rem;
    }
    
    .form-group {
        margin-bottom: 8px;
    }
    
    .other-resources p {
        margin-bottom: 8px;
        line-height: 1.4;
    }
}

/* Mobile portrait */
@media (max-width: 480px) {
    html {
        font-size: 13px;
    }
    
    .header-banner {
        padding: 0.75rem;
    }
    
    .main-nav {
        /* Consider collapsing to hamburger menu for very small screens */
        max-height: 200px;
       
        -webkit-overflow-scrolling: touch;
    }
    
    .feature-card {
        height: clamp(150px, 25vw, 200px);
    }
    
    .acknowledgment {
        padding: 20px 15px;
    }
    
    .agency-logos {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .logo-item img {
        max-width: 120px;
        max-height: 80px;
    }
    
    .user-login,
    .other-resources {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .user-login h3,
    .other-resources h3 {
        margin-bottom: 6px;
        font-size: 0.9rem;
    }
    
    .form-group {
        margin-bottom: 6px;
    }
    
    .form-group label {
        margin-bottom: 2px;
        font-size: 0.75rem;
    }
    
    .login-links {
        margin-top: 6px;
    }
    
    .login-links li {
        margin-bottom: 3px;
    }
    
    .resource-banner {
        margin: 8px 0;
    }
}

/* Extra small screens */
@media (max-width: 320px) {
    html {
        font-size: 12px;
    }
    
    .header-banner h1 {
        font-size: 1rem;
        line-height: 1.3;
    }
    
    .feature-card {
        height: 120px;
    }
    
    .card-content h3 {
        font-size: 1.2rem;
        padding: 0 0.5rem;
    }
}

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

/* Focus improvements for accessibility */
a:focus,
button:focus,
input:focus {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
input:focus:not(:focus-visible) {
    outline: none;
}

/* Ensure images don't break layout */
img {
    max-width: 100%;
    height: auto;
}

/* Better table responsiveness if any tables are added */
table {
    width: 100%;
    overflow-x: auto;
    display: block;
    white-space: nowrap;
}

@media (min-width: 768px) {
    table {
        display: table;
        white-space: normal;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .feature-card {
        border: 2px solid #000;
    }
    
    .card-content {
        background: rgba(0, 0, 0, 0.8);
    }
}
