/* 
 * wreTools - Dane County Land & Water Resources Department
 * Custom styles for Razor Pages with dark/light mode support
 * Consistent with LWRD government styling
 */

/* ============================================
   Theme Variables - Light & Dark Mode Support
   ============================================ */

:root {
    /* Dane County Brand Colors */
    --dc-blue-primary: #003f87;
    --dc-blue-dark: #002d5f;
    --dc-blue-light: #0059b3;
    
    /* Light Mode (Default) */
    --bg-body: #f8f9fa;
    --bg-surface: #ffffff;
    --bg-surface-secondary: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --border-color-light: #e9ecef;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --link-color: var(--dc-blue-primary);
    --link-hover: var(--dc-blue-dark);
    --navbar-toggler-filter: invert(1);
}

/* Dark Mode - Respects system/browser preference */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-body: #1a1f26;
        --bg-surface: #252b34;
        --bg-surface-secondary: #323a45;
        --text-primary: #f8f9fa;
        --text-secondary: #dee2e6;
        --text-muted: #adb5bd;
        --border-color: #404854;
        --border-color-light: #323a45;
        --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3);
        --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.5);
        --link-color: #6ea8fe;
        --link-hover: #a3c9ff;
        --navbar-toggler-filter: invert(0);
    }
}

/* ============================================
   Base Styles
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   Typography
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: 400;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* ============================================
   Layout Components
   ============================================ */

main {
    width: 100%;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ============================================
   Card Components
   ============================================ */

.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* Enhanced hover for horizontal layout cards (Related Resources) */
.card .row.align-items-center:hover {
    transform: translateX(2px);
}

.card-header {
    background-color: var(--bg-surface-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 1.25rem;
}

.card-title {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.card-text {
    color: var(--text-secondary);
}

.card-footer {
    background-color: var(--bg-surface-secondary);
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 1.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Card header overrides for Bootstrap bg-primary */
.card-header.bg-primary {
    background-color: var(--dc-blue-primary) !important;
    color: #ffffff !important;
}

.card-header.bg-primary h5,
.card-header.bg-primary .h5 {
    color: #ffffff !important;
}

/* ============================================
   Buttons - Government Professional Style
   ============================================ */

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: transparent;
}

.btn-primary {
    background-color: var(--dc-blue-primary);
    color: #ffffff;
    border-color: var(--dc-blue-primary);
}

.btn-primary:hover {
    background-color: var(--dc-blue-dark);
    border-color: var(--dc-blue-dark);
    color: #ffffff;
    text-decoration: none;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 63, 135, 0.25);
}

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-surface-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
    text-decoration: none;
}

.btn-outline-primary {
    color: var(--dc-blue-primary);
    border-color: var(--dc-blue-primary);
}

.btn-outline-primary:hover {
    background-color: var(--dc-blue-primary);
    color: #ffffff;
    text-decoration: none;
}

.btn-danger {
    background-color: #dc3545;
    color: #ffffff;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #bb2d3b;
    border-color: #b02a37;
    color: #ffffff;
    text-decoration: none;
}

.btn[disabled],
.btn:disabled {
    opacity: 0.65;
}

/* Dark mode - make disabled buttons more visible */
@media (prefers-color-scheme: dark) {
    .btn-outline-secondary:disabled,
    .btn-outline-secondary[disabled] {
        background-color: var(--bg-surface-secondary);
        border-color: var(--border-color);
        color: var(--text-secondary);
        opacity: 0.85;
    }
}

/* ============================================
   Forms
   ============================================ */

.form-control {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
}

.form-control:focus {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--dc-blue-light);
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(0, 63, 135, 0.25);
}

.form-label {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* ============================================
   Tables
   ============================================ */

.table {
    width: 100%;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.table th {
    background-color: var(--bg-surface-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
    font-weight: 600;
}

.table td {
    border-color: var(--border-color);
    color: var(--text-primary);
    background-color: var(--bg-surface);
}

.table-striped tbody tr:nth-of-type(odd) td {
    background-color: var(--bg-surface-secondary);
}

.table-hover tbody tr:hover td {
    background-color: var(--bg-surface-secondary);
}

/* Code elements in tables */
.table code {
    background-color: var(--bg-surface-secondary);
    color: var(--text-primary);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

/* ============================================
   Alerts & Status Badges
   ============================================ */

.alert {
    border-radius: 0.375rem;
    border: 1px solid transparent;
}

/* Dark mode alert adjustments */
@media (prefers-color-scheme: dark) {
    .alert-success {
        background-color: rgba(25, 135, 84, 0.2);
        border-color: rgba(25, 135, 84, 0.3);
        color: #75b798;
    }
    
    .alert-info {
        background-color: rgba(13, 110, 253, 0.2);
        border-color: rgba(13, 110, 253, 0.3);
        color: #6ea8fe;
    }
    
    .alert-warning {
        background-color: rgba(255, 193, 7, 0.2);
        border-color: rgba(255, 193, 7, 0.3);
        color: #ffda6a;
    }
    
    .alert-danger {
        background-color: rgba(220, 53, 69, 0.2);
        border-color: rgba(220, 53, 69, 0.3);
        color: #ea868f;
    }
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
}

/* ============================================
   Navigation & Header
   ============================================ */

.navbar {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* Override Bootstrap's bg-dark to respect theme */
.navbar.bg-dark {
    background-color: var(--bg-surface) !important;
}

.navbar-brand {
    color: var(--dc-blue-primary) !important;
    font-weight: 600;
    font-size: 1.25rem;
}

.navbar-brand:hover {
    color: var(--dc-blue-dark) !important;
}

/* Light mode - dark text on light navbar */
.navbar-dark .nav-link {
    color: var(--text-primary) !important;
}

.navbar-dark .nav-link:hover {
    color: var(--dc-blue-primary) !important;
}

.navbar-toggler-icon {
    filter: var(--navbar-toggler-filter);
}

/* Dark mode - bright text on dark navbar */
@media (prefers-color-scheme: dark) {
    .navbar-dark .nav-link {
        color: var(--text-primary) !important;
    }

    .navbar-dark .nav-link:hover {
        color: var(--link-color) !important;
    }
}

.dropdown-menu {
    background-color: var(--bg-surface);
    border-color: var(--border-color);
}

.dropdown-item {
    color: var(--text-primary);
}

.dropdown-item:hover {
    background-color: var(--bg-surface-secondary);
    color: var(--text-primary);
}

.dropdown-divider {
    border-color: var(--border-color);
}

/* ============================================
   Footer
   ============================================ */

footer,
footer.bg-body-tertiary,
.bg-body-tertiary {
    background-color: var(--bg-surface) !important;
    border-top: 1px solid var(--border-color);
}

footer .text-muted,
footer .text-center {
    color: var(--text-muted) !important;
}

footer p {
    margin-bottom: 0;
}

/* ============================================
   Utility Classes
   ============================================ */

.text-muted {
    color: var(--text-muted) !important;
}

.bg-light {
    background-color: var(--bg-surface-secondary) !important;
}

.border {
    border: 1px solid var(--border-color) !important;
}

.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

.shadow {
    box-shadow: var(--shadow-md) !important;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    .container {
        padding: 0 0.75rem;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    body {
        background-color: #ffffff;
        color: #000000;
    }
    
    .no-print {
        display: none !important;
    }
    
    a {
        text-decoration: underline;
    }
    
    .card {
        border: 1px solid #000000;
        box-shadow: none;
    }
}
