/* Old Basing Neighbourhood Plan - Main Stylesheet */

/* CSS Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* CSS Variables - Light Mode (Default) */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --bg-color: #ffffff;
    --bg-alt: #f9fafb;
    --bg-card: #ffffff;
    --header-bg: #ffffff;
    --footer-bg: #1f2937;
    --footer-text: #9ca3af;
    --input-bg: #ffffff;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

/* CSS Variables - Dark Mode */
[data-theme="dark"] {
    --primary-color: #3b82f6;
    --primary-hover: #60a5fa;
    --secondary-color: #94a3b8;
    --success-color: #34d399;
    --warning-color: #fbbf24;
    --error-color: #f87171;
    --text-color: #f3f4f6;
    --text-muted: #9ca3af;
    --border-color: #374151;
    --bg-color: #111827;
    --bg-alt: #1f2937;
    --bg-card: #1f2937;
    --header-bg: #1f2937;
    --footer-bg: #0f172a;
    --footer-text: #9ca3af;
    --input-bg: #374151;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
}

/* System preference dark mode */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --primary-color: #3b82f6;
        --primary-hover: #60a5fa;
        --secondary-color: #94a3b8;
        --success-color: #34d399;
        --warning-color: #fbbf24;
        --error-color: #f87171;
        --text-color: #f3f4f6;
        --text-muted: #9ca3af;
        --border-color: #374151;
        --bg-color: #111827;
        --bg-alt: #1f2937;
        --bg-card: #1f2937;
        --header-bg: #1f2937;
        --footer-bg: #0f172a;
        --footer-text: #9ca3af;
        --input-bg: #374151;
        --shadow: 0 1px 3px rgba(0,0,0,0.3);
        --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
    }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin: 0 0 1rem;
    font-weight: 600;
    line-height: 1.25;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.375rem; }

p { margin: 0 0 1rem; }

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

a:hover {
    text-decoration: underline;
}

.lead {
    font-size: 1.25rem;
    color: var(--text-muted);
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container-narrow {
    max-width: 720px;
}

.section {
    padding: 4rem 0;
}

.section-alt {
    background-color: var(--bg-alt);
}

.text-center {
    text-align: center;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    z-index: 1000;
}

.skip-link:focus {
    top: 0;
}

/* Header & Navigation - Two-tier design for many menu items */
.site-header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s ease;
}

/* Top bar - Logo and controls */
.header-top {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.logo:hover {
    opacity: 0.8;
    text-decoration: none;
}

.logo img {
    height: 36px;
    width: auto;
}

.site-logo {
    height: 36px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
}

.site-logo.themed-logo {
    filter: brightness(0) saturate(100%);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Navigation bar - Full width below logo */
.nav-bar {
    background: var(--bg-alt);
    border-top: 1px solid var(--border-color);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.nav-container::-webkit-scrollbar {
    display: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0;
}

.nav-menu li {
    flex-shrink: 0;
}

.nav-menu a {
    display: block;
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.875rem 1rem;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-bottom: 3px solid transparent;
}

.nav-menu a:hover {
    color: var(--primary-color);
    background: var(--header-bg);
    text-decoration: none;
}

.nav-menu a.active,
.nav-menu li.active > a {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Hamburger toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: background-color 0.2s ease;
}

.nav-toggle:hover {
    background: var(--bg-alt);
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-color);
    margin: 5px 0;
    transition: all 0.3s ease;
    border-radius: 1px;
}

/* Hamburger animation when active */
.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Scroll fade indicators */
.nav-bar::before,
.nav-bar::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.nav-bar::before {
    left: 0;
    background: linear-gradient(to right, var(--bg-alt), transparent);
}

.nav-bar::after {
    right: 0;
    background: linear-gradient(to left, var(--bg-alt), transparent);
}

.nav-bar.scrollable-left::before,
.nav-bar.scrollable-right::after {
    opacity: 1;
}

/* Mobile Navigation */
@media (max-width: 968px) {
    .nav-toggle {
        display: block;
    }

    .nav-bar {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--header-bg);
        border-top: 1px solid var(--border-color);
        border-bottom: 1px solid var(--border-color);
        box-shadow: var(--shadow-lg);
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }

    .nav-bar.active {
        display: block;
    }

    .nav-container {
        flex-direction: column;
        padding: 0;
        overflow-x: visible;
    }

    .nav-menu {
        flex-direction: column;
        width: 100%;
        gap: 0;
    }

    .nav-menu li {
        border-bottom: 1px solid var(--border-color);
    }

    .nav-menu li:last-child {
        border-bottom: none;
    }

    .nav-menu a {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        border-bottom: none;
        border-left: 3px solid transparent;
    }

    .nav-menu a:hover,
    .nav-menu a.active {
        border-left-color: var(--primary-color);
        border-bottom-color: transparent;
        background: var(--bg-alt);
    }
}

/* Compact mode for very small screens */
@media (max-width: 480px) {
    .header-top {
        padding: 0.5rem 1rem;
    }

    .logo {
        font-size: 1rem;
    }

    .site-logo {
        height: 32px;
        max-width: 150px;
    }
}

/* Flash Messages */
.flash-messages {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
}

.flash {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flash-success { background: #d1fae5; color: #065f46; }
.flash-error { background: #fee2e2; color: #991b1b; }
.flash-warning { background: #fef3c7; color: #92400e; }
.flash-info { background: #dbeafe; color: #1e40af; }

.flash-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.5;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    text-decoration: none;
}

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

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

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

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-full {
    width: 100%;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e3a8a 100%);
    color: white;
    padding: 5rem 0;
    text-align: center;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

.hero-description {
    font-size: 1.25rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 2rem;
}

/* Consultation Cards */
.consultation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.consultation-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
}

.consultation-card h3 {
    margin-bottom: 0.5rem;
}

.consultation-card h3 a {
    color: var(--text-color);
}

.consultation-card h3 a:hover {
    color: var(--primary-color);
}

.consultation-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.days-remaining {
    color: var(--warning-color);
    font-weight: 600;
}

.consultation-card-horizontal {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
}

.consultation-card-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active { background: #d1fae5; color: #065f46; }
.status-draft { background: #e5e7eb; color: #374151; }
.status-preview { background: #dbeafe; color: #1e40af; }
.status-closed { background: #fee2e2; color: #991b1b; }
.status-new { background: #dbeafe; color: #1e40af; }
.status-reviewed { background: #d1fae5; color: #065f46; }
.status-flagged { background: #fef3c7; color: #92400e; }

/* Forms */
.form-field {
    margin-bottom: 1.5rem;
}

.form-field label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="password"],
.form-field input[type="date"],
.form-field textarea,
.form-field select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s, background-color 0.3s ease;
    background-color: var(--input-bg);
    color: var(--text-color);
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-help {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.form-checkbox input[type="checkbox"] {
    margin-top: 0.25rem;
}

.form-checkbox label {
    margin-bottom: 0;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

fieldset {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

legend {
    font-weight: 600;
    padding: 0 0.5rem;
}

/* Auth Card */
.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    margin: 2rem auto;
    transition: background-color 0.3s ease;
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 1.5rem;
}

/* Document List */
.document-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.document-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
}

.document-icon {
    flex-shrink: 0;
}

.document-icon .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 700;
}

.icon-pdf { background: #fee2e2; color: #991b1b; }
.icon-file { background: #dbeafe; color: #1e40af; }

.document-info {
    flex: 1;
    min-width: 0;
}

.document-info h3 {
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.document-meta {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.document-actions {
    display: flex;
    gap: 0.5rem;
}

/* Success Message */
.success-message {
    padding: 3rem 0;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1.5rem;
}

.success-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

/* Error Pages */
.error-page h1 {
    font-size: 6rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.error-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

/* Footer */
.site-footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 2rem 0;
    margin-top: auto;
    transition: background-color 0.3s ease;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: var(--footer-text);
}

.footer-links a:hover {
    color: #ffffff;
}

/* No Items */
.no-items {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    background: var(--bg-alt);
    border-radius: var(--radius);
}

/* Utilities */
.text-muted { color: var(--text-muted); }

/* Consultation Detail */
.consultation-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e3a8a 100%);
    color: white;
    padding: 3rem 0;
}

.consultation-status {
    margin: 1rem 0;
}

.consultation-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

.consultation-cta {
    background: var(--bg-alt);
    text-align: center;
}

/* Contact */
.contact-info {
    display: grid;
    gap: 2rem;
    margin: 2rem 0;
}

.contact-item h3 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
    color: var(--text-muted);
}

/* Page Intro */
.page-intro {
    font-size: 1.125rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Content Area */
.content h2 { margin-top: 2rem; }
.content h3 { margin-top: 1.5rem; }
.content ul, .content ol { padding-left: 1.5rem; }
.content li { margin-bottom: 0.5rem; }

/* Responsive */
@media (max-width: 768px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }

    .hero {
        padding: 3rem 0;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .section {
        padding: 2.5rem 0;
    }

    .consultation-card-horizontal {
        flex-direction: column;
    }

    .consultation-card-actions {
        flex-direction: row;
    }

    .footer-container {
        flex-direction: column;
        text-align: center;
    }
}

/* Dark Mode Toggle */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.theme-toggle:hover {
    background: var(--bg-alt);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.theme-toggle .icon-sun {
    display: none;
}

.theme-toggle .icon-moon {
    display: block;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun {
        display: block;
    }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon {
        display: none;
    }
}


/* Dark mode utility class overrides */
.bg-light {
    background-color: var(--bg-alt);
    transition: background-color 0.3s ease;
}

/* Card backgrounds for dark mode */
.card,
.auth-card,
.consultation-card,
.document-item,
.featured-card {
    background: var(--bg-card);
    transition: background-color 0.3s ease;
}

/* Submenu styles for dropdown navigation */
.nav-menu li {
    position: relative;
}

.nav-submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--header-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    min-width: 200px;
    padding: 0.5rem 0;
    box-shadow: var(--shadow-lg);
    list-style: none;
    z-index: 100;
}

.nav-menu li:hover > .nav-submenu {
    display: block;
}

.nav-submenu li {
    padding: 0;
}

.nav-submenu a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-color);
}

.nav-submenu a:hover {
    background: var(--bg-alt);
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .nav-submenu {
        position: static;
        border: none;
        box-shadow: none;
        padding-left: 1rem;
        display: block;
    }
}
