/* Widows Sons Rides - Main Stylesheet */

/* ============================================================================
   CSS VARIABLES - Black and Gold Theme
   ============================================================================ */
:root {
    --primary: #d4a017;
    --primary-dark: #b8860b;
    --secondary: #4a4a4a;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;

    --bg: #f5f5f5;
    --bg-card: #ffffff;
    --text: #1a1a1a;
    --text-muted: #5a5a5a;
    --border: #d4d4d4;

    --gold: #d4a017;
    --gold-light: #f0d77a;
    --black: #1a1a1a;

    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
}

/* ============================================================================
   RESET & BASE
   ============================================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

a:hover {
    color: var(--gold);
    text-decoration: underline;
}

/* ============================================================================
   LAYOUT
   ============================================================================ */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.main-content {
    flex: 1;
    padding: 2rem 0;
}

/* ============================================================================
   HEADER - Black and Gold
   ============================================================================ */
.site-header {
    background: var(--black);
    color: var(--gold);
    padding: 1rem 0;
    border-bottom: 3px solid var(--gold);
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gold);
}

.logo:hover {
    text-decoration: none;
    color: var(--gold-light);
}

.main-nav {
    display: flex;
    gap: 1.5rem;
}

.main-nav a {
    color: var(--gold);
    font-weight: 500;
}

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

/* PWA Back Button - only visible in standalone mode (installed PWA) */
.pwa-back-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--gold);
    padding: 0.5rem;
    margin-right: 0.5rem;
    cursor: pointer;
    border-radius: var(--radius);
}

.pwa-back-btn:hover {
    background: rgba(212, 160, 23, 0.1);
}

.pwa-back-btn svg {
    display: block;
}

/* Show back button in PWA standalone mode */
@media (display-mode: standalone) {
    .pwa-back-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* JS adds this class for iOS standalone detection */
body.pwa-standalone .pwa-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================================
   FOOTER - Black and Gold
   ============================================================================ */
.site-footer {
    background: var(--black);
    color: var(--gold);
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.875rem;
    border-top: 3px solid var(--gold);
}

.site-footer .version {
    color: rgba(212, 160, 23, 0.5);
    margin-left: 1rem;
}

.footer-branding {
    margin-bottom: 0.5rem;
}

.gasket-name {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
}

.gasket-tagline {
    display: block;
    font-size: 0.75rem;
    color: rgba(212, 160, 23, 0.7);
    margin-top: 0.25rem;
}

@media (min-width: 768px) {
    .gasket-tagline {
        display: inline;
        margin-left: 0.5rem;
    }
    .gasket-tagline::before {
        content: '— ';
    }
}

.footer-links {
    margin: 0.5rem 0;
}

.footer-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.footer-link:hover {
    background: var(--primary);
    color: #000;
}

.footer-divider {
    color: var(--text-muted);
    margin: 0 0.25rem;
}

.footer-copyright {
    margin: 0;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.1s;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

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

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

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

.btn-secondary:hover {
    background: #475569;
}

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

.btn-danger:hover {
    background: #b91c1c;
}

.btn-gold {
    background: #f59e0b;
    color: white;
}

.btn-gold:hover {
    background: #d97706;
}

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

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

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

.btn-large {
    padding: 0.875rem 1.75rem;
    font-size: 1.0625rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* ============================================================================
   FLASH MESSAGES
   ============================================================================ */
.flash {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-weight: 500;
}

.flash-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.flash-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.flash-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* ============================================================================
   HERO SECTION
   ============================================================================ */
.hero {
    text-align: center;
    padding: 3rem 0;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

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

/* ============================================================================
   CHAPTER SELECTION
   ============================================================================ */
.chapter-select {
    text-align: center;
    padding: 2rem 0;
}

.chapter-select h2 {
    margin-bottom: 0.5rem;
}

.chapter-select > p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    max-width: 800px;
    margin: 0 auto;
}

.chapter-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 2px solid transparent;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chapter-card:hover {
    text-decoration: none;
    border-color: var(--gold);
    box-shadow: var(--shadow-lg);
}

.chapter-card h3 {
    font-size: 1.5rem;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.chapter-card p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.chapter-card .ride-count {
    font-size: 0.875rem;
    color: var(--gold);
    font-weight: 600;
}

/* ============================================================================
   BREADCRUMB
   ============================================================================ */
.breadcrumb {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.breadcrumb a {
    color: var(--text-muted);
}

.breadcrumb a:hover {
    color: var(--primary);
}

/* ============================================================================
   PAGE HEADER
   ============================================================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
}

.chapter-description {
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* ============================================================================
   RIDES LIST
   ============================================================================ */
.rides-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.rides-header h2 {
    margin: 0;
}

.rides-list h2 {
    margin-bottom: 1.5rem;
}

.ride-card {
    display: flex;
    gap: 1.5rem;
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    align-items: flex-start;
}

.ride-date-link {
    text-decoration: none;
    display: block;
}

.ride-date {
    text-align: center;
    min-width: 70px;
    padding: 0.75rem;
    background: var(--gold);
    color: var(--black);
    border-radius: var(--radius);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ride-date-link:hover .ride-date,
.ride-date-link:active .ride-date {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(212, 160, 23, 0.4);
}

.ride-date-link:active .ride-date {
    transform: scale(0.98);
}

.ride-date .day {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.ride-date .month {
    display: block;
    font-size: 0.875rem;
    text-transform: uppercase;
}

.ride-date .year {
    display: block;
    font-size: 0.75rem;
    opacity: 0.8;
}

.ride-date .tbc {
    font-size: 0.875rem;
    font-weight: 600;
}

.ride-info {
    flex: 1;
}

.ride-info h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.ride-info h3 a {
    color: var(--text);
}

.ride-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.ride-type {
    background: #e2e8f0;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.start-points {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.start-point {
    margin-bottom: 0.25rem;
}

.ride-destination {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.ride-counts {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.signup-count {
    font-size: 0.875rem;
    color: var(--success);
    font-weight: 500;
}

.photo-count {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    background: rgba(212, 160, 23, 0.15);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.photo-count:hover {
    background: rgba(212, 160, 23, 0.3);
    color: var(--primary-dark);
}

.photo-count svg {
    opacity: 0.9;
}

.attachment-count {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    color: #2563eb;
    font-weight: 600;
    background: rgba(37, 99, 235, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
}

.attachment-count svg {
    opacity: 0.9;
}

.ride-actions {
    display: flex;
    align-items: center;
}

/* ============================================================================
   BADGE
   ============================================================================ */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    vertical-align: middle;
    margin-left: 0.5rem;
}

.badge-featured {
    background: var(--gold);
    color: var(--black);
}

.badge-cancelled {
    background: var(--danger);
    color: white;
}

.badge-completed {
    background: var(--success);
    color: white;
}

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

.badge-external {
    background: #6366f1;
    color: white;
}

.badge-info-only {
    background: #64748b;
    color: white;
}

/* ============================================================================
   STATUS BANNERS
   ============================================================================ */
.ride-cancelled-banner,
.ride-completed-banner,
.ride-unavailable {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    text-align: center;
}

.ride-cancelled-banner {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
}

.ride-completed-banner {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: var(--success);
}

.ride-unavailable {
    background: #f8fafc;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

/* ============================================================================
   CONTACT DETAILS
   ============================================================================ */
.contact-details,
.chapter-contacts {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.contacts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.contact-card {
    background: var(--bg);
    padding: 1rem;
    border-radius: var(--radius);
}

.contact-card h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.contact-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.contact-bike {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.contact-phone,
.contact-email {
    font-size: 0.9rem;
}

.social-links {
    margin-top: 1rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-social {
    font-size: 0.85rem;
}

.btn-facebook {
    background: #1877f2;
    color: white;
}

.btn-facebook:hover {
    background: #166fe5;
}

.btn-whatsapp {
    background: #25d366;
    color: white;
}

.btn-whatsapp:hover {
    background: #22c55e;
}

/* Officers Collapsible Section */
.officers-collapsible {
    border: none;
}

.officers-toggle {
    display: block;
    cursor: pointer;
    padding: 0.5rem 0;
    list-style: none;
}

.officers-toggle::-webkit-details-marker {
    display: none;
}

.officers-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.officers-toggle h2 {
    margin: 0;
    font-size: 1.1rem;
}

.officer-count {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.officers-summary {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text);
}

.officers-collapsible[open] .officers-summary {
    display: none;
}

.summary-officer {
    display: inline-block;
    margin-right: 1.5rem;
    margin-bottom: 0.25rem;
}

.summary-officer a {
    color: var(--primary);
}

.toggle-icon {
    margin-left: auto;
    width: 20px;
    height: 20px;
    position: relative;
}

.toggle-icon::before,
.toggle-icon::after {
    content: '';
    position: absolute;
    background: var(--text-muted);
    transition: transform 0.2s ease;
}

.toggle-icon::before {
    width: 12px;
    height: 2px;
    top: 9px;
    left: 4px;
}

.toggle-icon::after {
    width: 2px;
    height: 12px;
    top: 4px;
    left: 9px;
}

.officers-collapsible[open] .toggle-icon::after {
    transform: rotate(90deg);
    opacity: 0;
}

.officers-collapsible .contacts-grid {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* On mobile, stack summary officers vertically */
@media (max-width: 600px) {
    .summary-officer {
        display: block;
        margin-right: 0;
    }
}

/* ============================================================================
   RIDE LEADER
   ============================================================================ */
.ride-leader {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

/* ============================================================================
   CHAPTER HEADER
   ============================================================================ */
.chapter-header-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.chapter-header-badge {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: var(--radius);
}

/* ============================================================================
   PAST RIDE STYLING
   ============================================================================ */
.past-ride {
    opacity: 0.8;
}

.past-ride .ride-date {
    background: var(--secondary);
}

/* ============================================================================
   RIDE DETAIL
   ============================================================================ */
.ride-detail {
    margin-bottom: 2rem;
}

.ride-header {
    margin-bottom: 2rem;
}

.ride-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.ride-meta-large {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    color: var(--text-muted);
}

.ride-meta-large .date {
    font-weight: 600;
    color: var(--gold);
}

.btn-copy-link {
    margin-top: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.btn-copy-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-copy-link.btn-copied {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.calendar-dropdown {
    display: inline-block;
    position: relative;
    margin-top: 0.75rem;
    margin-left: 0.5rem;
}

.btn-calendar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.calendar-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    min-width: 200px;
    z-index: 100;
}

.calendar-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s;
}

.calendar-dropdown-menu a:hover {
    background: var(--bg-hover, #f3f4f6);
}

.calendar-dropdown-menu a span {
    font-weight: 700;
    color: #4285f4;
    font-size: 0.9rem;
}

.copy-icon {
    margin-right: 4px;
}

.start-points-detail h2,
.route-section h2,
.stops-section h2,
.notes-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.start-points-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.start-point-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--gold);
}

.start-point-card.secondary {
    border-left-color: var(--secondary);
}

.start-point-card h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.start-point-card .location {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.start-point-card .time {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gold);
}

/* Weather Section */
.weather-section {
    margin-bottom: 2rem;
}

.weather-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.weather-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.weather-card {
    background: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 100%);
    padding: 1.25rem;
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid #bae6fd;
}

.weather-card h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.weather-icon {
    font-size: 2.5rem;
    margin: 0.5rem 0;
}

.weather-desc {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.weather-details {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
}

.weather-details .temp {
    font-weight: 600;
}

.weather-details .temp-high {
    color: #dc2626;
}

.weather-details .temp-low {
    color: #2563eb;
}

.weather-details .rain,
.weather-details .wind {
    color: var(--text-muted);
}

.weather-credit {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

.weather-credit a {
    color: var(--text-muted);
    text-decoration: underline;
}

.weather-unavailable {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 1rem;
    background: var(--bg-muted);
    border-radius: var(--radius);
}

.linked-info {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.linked-info a {
    font-weight: 600;
}

/* ============================================================================
   DATE CLASH WARNING
   ============================================================================ */
.date-clash-box {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.date-clash-box strong {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.date-clash-box ul {
    margin: 0;
    padding-left: 1.25rem;
}

.date-clash-box li {
    margin-bottom: 0.25rem;
}

.date-clash-warning {
    background: #fffbeb;
    border-color: #f59e0b;
    color: #92400e;
}

.date-clash-error {
    background: #fef2f2;
    border-color: #dc2626;
    color: #991b1b;
}

.clash-error {
    font-weight: 600;
}

.clash-note {
    margin-top: 0.75rem;
    margin-bottom: 0;
    font-size: 0.875rem;
    font-style: italic;
}

.route-section,
.stops-section,
.notes-section {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.route-description,
.stops-description {
    line-height: 1.8;
    color: var(--text-muted);
}

/* ============================================================================
   SIGNUP FORM
   ============================================================================ */
.signup-section {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.signup-section h2 {
    margin-bottom: 1.5rem;
}

.signup-form {
    max-width: 700px;
}

.apology-badge {
    display: inline-block;
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-weight: 600;
}

.apologies-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border, #eee);
}

.apologies-intro {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.apology-form .form-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.apology-form .form-group {
    flex: 1;
    min-width: 140px;
    margin-bottom: 0;
}

.apology-form input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

.apologies-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.apologies-list li {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 0.35rem 0.75rem;
    font-size: 0.9rem;
}

.apology-reason {
    color: #666;
    font-style: italic;
}

.signup-notice {
    background: #f0f4ff;
    border: 1px solid #c7d4f5;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.signup-notice-text {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    color: #444;
    line-height: 1.6;
}

.signup-notice-text a {
    color: var(--primary, #e94560);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.375rem;
}

.form-group small {
    color: var(--text-muted);
    font-weight: normal;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: white;
    transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(212, 160, 23, 0.2);
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.radio-group.horizontal {
    flex-direction: row;
    gap: 1.5rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: normal;
}

.radio-label input {
    width: auto;
}

.capacity-full {
    background: #fee2e2;
    color: #991b1b;
    padding: 1rem;
    border-radius: var(--radius);
}

.capacity-info {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* ============================================================================
   SIGNUPS LIST (PUBLIC)
   ============================================================================ */
.signups-list {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.signups-list h2 {
    margin-bottom: 1rem;
}

.signups-table {
    width: 100%;
    border-collapse: collapse;
}

.signups-table th,
.signups-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.signups-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.signup-summary {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 2rem;
}

/* ============================================================================
   ADMIN: LOGIN
   ============================================================================ */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.login-box {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-box h1 {
    margin-bottom: 0.5rem;
}

.login-box > p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.login-form {
    text-align: left;
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.back-link {
    margin-top: 1.5rem;
    font-size: 0.875rem;
}

/* ============================================================================
   ADMIN: DASHBOARD
   ============================================================================ */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gold);
}

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

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.dashboard-section {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.dashboard-section.full-width {
    grid-column: 1 / -1;
}

.dashboard-section h2 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

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

.chapter-list {
    list-style: none;
}

.chapter-list li {
    border-bottom: 1px solid var(--border);
}

.chapter-list li:last-child {
    border-bottom: none;
}

.chapter-list a {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    color: var(--text);
}

.chapter-list a:hover {
    text-decoration: none;
    color: var(--gold);
}

.chapter-list span {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ============================================================================
   ADMIN: DATA TABLES
   ============================================================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table th,
.data-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table .row-cancelled {
    background: #fef2f2;
    opacity: 0.8;
}

.data-table .row-completed {
    background: #f0fdf4;
    opacity: 0.8;
}

.data-table code {
    background: #e2e8f0;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.875rem;
}

.actions-cell {
    white-space: nowrap;
}

.actions-cell .btn {
    margin-right: 0.25rem;
}

.inline-form {
    display: inline;
}

.tbc {
    color: var(--text-muted);
    font-style: italic;
}

/* ============================================================================
   ADMIN: FORMS
   ============================================================================ */
.admin-form {
    max-width: 800px;
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

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

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

.checkbox-group {
    display: flex;
    align-items: center;
    padding-top: 1.75rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-group input {
    width: auto;
}

.whatsapp-highlight,
.whatsapp-opt-in-banner {
    background: linear-gradient(135deg, #dcf8c6 0%, #e8f5e9 100%);
    border: 2px solid #25D366;
    border-radius: var(--radius);
    padding: 1rem !important;
    margin: 0.5rem 0 1rem 0;
}

.whatsapp-highlight .checkbox-label,
.whatsapp-opt-in-banner .checkbox-label {
    font-weight: 600;
    color: #128C7E;
    font-size: 1rem;
}

.whatsapp-highlight small,
.whatsapp-opt-in-banner small {
    color: #075E54;
    display: block;
    margin-top: 0.35rem;
    margin-left: 1.5rem;
}

.form-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 1rem;
}

.filter-bar {
    margin-bottom: 1.5rem;
}

.filter-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-form label {
    font-weight: 500;
}

.filter-form select {
    width: auto;
    min-width: 200px;
}

/* ============================================================================
   ADMIN: RIDE VIEW
   ============================================================================ */
.header-actions {
    display: flex;
    gap: 0.5rem;
}

.ride-info-section {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.info-grid {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 0.5rem 1rem;
}

.info-grid dt {
    font-weight: 600;
    color: var(--text-muted);
}

.signup-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: #f8fafc;
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
}

.summary-card .count {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--gold);
}

.summary-card .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.signups-section h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-muted);
}

/* ============================================================================
   ACTIONS BAR
   ============================================================================ */
.actions-bar {
    margin: 1.5rem 0;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

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

.actions-more {
    position: relative;
}

.actions-more summary {
    cursor: pointer;
    list-style: none;
}

.actions-more summary::-webkit-details-marker {
    display: none;
}

.actions-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 160px;
    z-index: 100;
    margin-top: 0.25rem;
}

.actions-dropdown a {
    display: block;
    padding: 0.6rem 1rem;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
}

.actions-dropdown a:last-child {
    border-bottom: none;
}

.actions-dropdown a:hover {
    background: var(--bg-muted);
}

@media (max-width: 480px) {
    .actions-bar {
        justify-content: center;
    }

    .actions-primary .btn {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }
}

/* ============================================================================
   NO DATA
   ============================================================================ */
.no-data {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-style: italic;
}

/* ============================================================================
   ROAD NAME FIELD
   ============================================================================ */
.road-name-group {
    background: #fffbeb;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border: 2px solid var(--gold);
}

.road-name-group label {
    color: var(--gold-dark, #b8860b);
    font-weight: 600;
}

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

.road-name-status {
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

.status-found {
    color: var(--success);
    font-weight: 500;
}

.status-new {
    color: var(--primary-dark);
}

/* ============================================================================
   LEADERBOARD
   ============================================================================ */
.leaderboard-section {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-top: 2rem;
}

.leaderboard-section h2 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.leaderboard-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.leaderboard-card {
    background: #f8fafc;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 200px;
}

.leaderboard-card.top-three {
    border-left: 4px solid var(--gold);
}

.leaderboard-card .rank {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gold);
    min-width: 2rem;
}

.leaderboard-card .road-name {
    font-weight: 600;
    flex: 1;
}

.leaderboard-card .chapter-name {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.leaderboard-card .ride-count {
    color: var(--text-muted);
    font-size: 0.875rem;
    white-space: nowrap;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 768px) {
    .site-header .container {
        flex-direction: column;
        gap: 1rem;
    }

    .main-nav {
        gap: 1rem;
    }

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

    .ride-card {
        flex-direction: column;
    }

    .ride-date {
        align-self: flex-start;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .data-table {
        display: block;
        overflow-x: auto;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .info-grid dt {
        margin-top: 0.5rem;
    }
}

/* ============================================================================
   SIGNUP CONFIRMATION
   ============================================================================ */

.signup-confirmation {
    text-align: center;
    padding: 2.5rem 1.5rem;
    background: #dcfce7;
    border: 2px solid #86efac;
    border-radius: var(--radius);
}

.signup-confirmation-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: #166534;
    color: #fff;
    border-radius: 50%;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.signup-confirmation h2 {
    color: #166534;
    margin: 0 0 0.5rem 0;
}

.signup-confirmation p {
    color: #15803d;
    margin: 0 0 1.5rem 0;
    font-size: 1.05rem;
}

/* ============================================================================
   EVENT STYLING
   ============================================================================ */
.badge-event {
    background: #7c3aed;
    color: white;
}

.ride-card-event {
    border-left: 4px solid #7c3aed;
}

.ride-date-event {
    background: #7c3aed !important;
    color: white;
}

.date-range {
    display: block;
    font-size: 0.7rem;
    margin-top: 2px;
    opacity: 0.9;
}

.attendance-badge-guest {
    background: #7c3aed;
}

/* ============================================================================
   CALENDAR VIEW
   ============================================================================ */
.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.calendar-month-title {
    font-size: 1.5rem;
    margin: 0;
    text-align: center;
}

.calendar-wrapper {
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.calendar-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.calendar-table th {
    background: var(--black);
    color: var(--gold);
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
}

.calendar-day {
    border: 1px solid #e2e8f0;
    vertical-align: top;
    padding: 0.5rem;
    min-height: 80px;
    height: 100px;
    background: var(--bg-card);
}

.calendar-day-empty {
    background: #f8f9fa;
}

.calendar-day-today {
    background: #fffbeb;
    border-color: var(--gold);
}

.calendar-day-number {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 4px;
    color: var(--text-muted);
}

.calendar-day-today .calendar-day-number {
    color: var(--gold);
}

.calendar-rides {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.calendar-ride {
    display: block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    text-decoration: none;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.calendar-ride:hover {
    opacity: 0.85;
    text-decoration: none;
}

.calendar-ride-short,
.calendar-ride- {
    background: var(--gold);
    color: var(--black);
}

.calendar-ride-long {
    background: var(--secondary);
}

.calendar-ride-event {
    background: #7c3aed;
}

.calendar-ride-cancelled {
    text-decoration: line-through;
    opacity: 0.5;
}

.calendar-legend {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 2rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.calendar-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.calendar-legend-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

.calendar-legend-short {
    background: var(--gold);
}

.calendar-legend-long {
    background: var(--secondary);
}

.calendar-legend-event {
    background: #7c3aed;
}

/* Calendar mobile */
@media (max-width: 768px) {
    .calendar-table th {
        font-size: 0.75rem;
        padding: 0.5rem 0.25rem;
    }

    .calendar-day {
        padding: 0.25rem;
        min-height: 60px;
        height: 70px;
    }

    .calendar-day-number {
        font-size: 0.75rem;
    }

    .calendar-ride {
        font-size: 0.6rem;
        padding: 1px 3px;
    }

    .calendar-nav {
        flex-wrap: wrap;
    }

    .calendar-month-title {
        font-size: 1.25rem;
        order: -1;
        width: 100%;
    }

    .calendar-legend {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
}

/* ============================================================================
   ERROR PAGES
   ============================================================================ */
.error-page {
    text-align: center;
    padding: 3rem 1rem;
    max-width: 500px;
    margin: 0 auto;
}

.error-icon {
    margin-bottom: 2rem;
}

.error-icon svg {
    width: 120px;
    height: 80px;
    color: var(--gold);
}

.error-page h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--black);
}

.error-page h2 {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.error-code {
    display: inline-block;
    background: var(--black);
    color: var(--gold);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.error-message {
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.6;
}

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

/* ============================================================================
   PHOTO GALLERY
   ============================================================================ */

.photos-section {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.photos-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.photos-section h2::before {
    content: "📸";
}

.photos-section p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.photos-section .btn {
    margin-right: 0.5rem;
}

/* ============================================================================
   ADMIN QUICK ACTIONS (Glove-friendly)
   ============================================================================ */

.admin-quick-actions {
    margin-bottom: 1rem;
}

.btn-attendance {
    display: block;
    width: 100%;
    padding: 1.25rem 2rem;
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    color: var(--black);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(212, 160, 23, 0.4);
    transition: all 0.2s ease;
    /* Extra touch-friendly */
    min-height: 60px;
    -webkit-tap-highlight-color: transparent;
}

.btn-attendance:hover,
.btn-attendance:active {
    transform: scale(1.02);
    box-shadow: 0 6px 16px rgba(212, 160, 23, 0.5);
    color: var(--black);
}

.btn-attendance:active {
    transform: scale(0.98);
}

.btn-attendance-dim {
    background: var(--secondary);
    color: var(--text-muted);
    box-shadow: none;
}

.btn-attendance-dim:hover {
    transform: none;
    box-shadow: none;
}

/* ============================================================================
   CHAPTER TAB NAVIGATION
   ============================================================================ */

.chapter-tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-card);
    padding: 0.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.chapter-tabs .tab {
    flex: 1;
    text-align: center;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.chapter-tabs .tab:hover {
    background: var(--bg-muted);
}

.chapter-tabs .tab.active {
    background: var(--primary);
    color: var(--black);
    font-weight: 600;
}

.chapter-tabs .tab-suggest {
    background: var(--bg-muted);
    color: var(--primary-dark);
}

.chapter-tabs .tab-suggest:hover,
.chapter-tabs .tab-suggest.active {
    background: var(--primary);
    color: var(--black);
}

/* Chapter quick links (Officers, Facebook, WhatsApp) */
.chapter-links {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.chapter-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.25rem 0;
}

.chapter-link:hover {
    text-decoration: underline;
}

/* Officers section when shown */
.officers-section {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.officers-section h2 {
    margin-bottom: 1rem;
}

@media (max-width: 600px) {
    .chapter-tabs {
        gap: 0.125rem;
        padding: 0.375rem;
    }

    .chapter-tabs .tab {
        padding: 0.625rem 0.5rem;
        font-size: 0.875rem;
    }
}

/* Badge Icons (Member Achievements) */
.badge-icons {
    font-size: 0.85em;
    letter-spacing: 0.05em;
    opacity: 0.9;
    white-space: nowrap;
}

/* ============================================================================
   ROUTE WAYPOINTS (Public View)
   ============================================================================ */
.waypoints-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f9f9f9;
    border-radius: 8px;
}

.waypoints-section h2 {
    margin-top: 0;
    margin-bottom: 1rem;
}

.route-stops {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
    position: relative;
}

.route-stops::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 20px;
    bottom: 20px;
    width: 2px;
    background: #ddd;
}

.route-stop {
    position: relative;
    padding: 0.75rem 0 0.75rem 40px;
    border-bottom: 1px solid #eee;
}

.route-stop:last-child {
    border-bottom: none;
}

.route-stop::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #999;
}

.route-stop.start::before {
    border-color: #2e7d32;
    background: #2e7d32;
}

.route-stop.secondary-start::before {
    border-color: #7b1fa2;
    background: #7b1fa2;
}

.route-stop.destination::before {
    border-color: #c62828;
    background: #c62828;
}

.route-stop.waypoint::before {
    border-color: #1976d2;
}

.route-stop .time {
    color: #666;
    font-size: 0.9em;
    margin-left: 0.5rem;
}

.route-stop .postcode {
    color: #999;
    font-size: 0.85em;
    margin-left: 0.5rem;
}

.route-stop .badge-join {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.route-stop .badge-leg-main {
    background: #dcfce7;
    color: #16a34a;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.route-stop .badge-leg-secondary {
    background: #dbeafe;
    color: #2563eb;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.route-stop .waypoint-notes {
    display: block;
    color: #666;
    font-size: 0.85em;
    margin-top: 0.25rem;
}

.route-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.route-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Route Layout - Side by side on desktop, stacked on mobile */
.route-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .route-layout {
        grid-template-columns: 1fr;
    }
}

.route-list {
    min-width: 0;
}

.route-map-container {
    min-width: 0;
}

#route-map {
    width: 100%;
    height: 300px;
    border-radius: 8px;
    background: #e0e0e0;
}

@media (min-width: 769px) {
    #route-map {
        height: 100%;
        min-height: 300px;
    }
}

.map-unavailable {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #666;
    font-style: italic;
    background: #f5f5f5;
    border-radius: 8px;
}

/* Custom map markers */
.route-marker {
    display: flex;
    align-items: center;
    justify-content: center;
}

.route-marker .marker-dot {
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.start-marker .marker-dot {
    width: 14px;
    height: 14px;
    background: #2e7d32;
}

.secondary-start-marker .marker-dot {
    width: 12px;
    height: 12px;
    background: #7b1fa2;
}

.waypoint-marker .marker-dot {
    width: 10px;
    height: 10px;
    background: #1976d2;
}

.join-marker .marker-dot {
    width: 12px;
    height: 12px;
    background: #ff9800;
}

.destination-marker .marker-dot {
    width: 14px;
    height: 14px;
    background: #d32f2f;
}

/* Leaflet popup styling */
.leaflet-popup-content {
    font-size: 0.9rem;
    line-height: 1.4;
}

.leaflet-popup-content strong {
    color: #333;
}

.map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #666;
    margin: 0;
}

/* ============================================================================
   PUBLIC ATTACHMENTS
   ============================================================================ */

.attachments-section-public {
    margin-top: 2rem;
}

.attachments-section-public h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: #333;
}

.attachments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.attachment-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: background 0.2s, transform 0.2s;
    border: 1px solid #e0e0e0;
}

.attachment-card:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.attachment-icon-public {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 8px;
    color: #666;
}

.attachment-card.pdf-icon .attachment-icon-public {
    background: #ffebee;
    color: #c62828;
}

.attachment-card.csv-icon .attachment-icon-public {
    background: #e8f5e9;
    color: #2e7d32;
}

.attachment-card.image-icon .attachment-icon-public {
    background: #e3f2fd;
    color: #1565c0;
}

.attachment-card.link-icon .attachment-icon-public {
    background: #fff3e0;
    color: #ef6c00;
}

.attachment-title-public {
    font-size: 0.9rem;
    text-align: center;
    word-break: break-word;
}

@media (max-width: 480px) {
    .attachments-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.required-indicator { color: #e94560; font-weight: 700; margin-left: 2px; }
