/* ==========================================================================
   S/V CHIM CHIM - MAIN STYLESHEET
   v4.0 (Utility class consolidation)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. FONTS & BASIC RESET
   -------------------------------------------------------------------------- */
:root {
    /* DEFAULT THEME VARIABLES */
    /* These values are overridden by the Style Editor via header.php */
    --primary-color: #007bff;
    --page-bg: #f4f4f4;
    --header-bg: #ffffff;
    --card-radius: 8px;
    --page-top-margin: 5px;
    --sidebar-link-color: #555;
}

/* --------------------------------------------------------------------------
   0a. GLOBAL UTILITY CLASSES
   -------------------------------------------------------------------------- */

/* Text */
.text-muted       { color: #999; }
.text-muted-dark  { color: #666; }
.text-sm          { font-size: 0.85rem; }
.text-xs          { font-size: 0.75rem; }
.text-italic      { font-style: italic; }
.text-center      { text-align: center; }
.text-bold        { font-weight: 600; }
.text-primary     { color: var(--primary-color); }
.text-white       { color: #fff; }

/* Section label — small caps above a form group or section */
.section-label {
    font-size: 0.72rem; text-transform: uppercase;
    letter-spacing: 1px; color: #aaa; font-weight: 700; margin-bottom: 10px;
    display: block;
}

/* Links */
.link-muted { text-decoration: none; color: #666; }
.link-dark  { text-decoration: none; color: #333; }
.link-mid   { text-decoration: none; color: #555; }
.link-muted:hover, .link-dark:hover, .link-mid:hover { color: var(--primary-color); }

/* Layout */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center  { display: flex; justify-content: center; align-items: center; }
.flex-end     { display: flex; justify-content: flex-end; align-items: center; }
.gap-10 { gap: 10px; }
.gap-15 { gap: 15px; }
.gap-20 { gap: 20px; }
.mb-0  { margin-bottom: 0 !important; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mt-0  { margin-top: 0 !important; }
.w-100 { width: 100%; }

/* Lists */
.list-clean      { list-style: none; padding: 0; margin: 0; }
.sidebar-link-list { list-style: none; padding: 0; margin: 0; line-height: 2.2; font-size: 0.95rem; }
.sidebar-link-list a { text-decoration: none; color: var(--sidebar-link-color); }
.sidebar-link-list a:hover { color: var(--primary-color); }

/* Card header row — title + action button on same line */
.card-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }

/* Section divider — horizontal rule between form sections */
.section-divider { border-top: 1px solid #eee; padding-top: 14px; margin-bottom: 14px; }

/* Empty / no-data states */
.empty-state { text-align: center; padding: 40px; color: #999; }

/* Large stat number */
.stat-number { font-size: 2rem; font-weight: bold; color: var(--primary-color); }

/* Dark panel header (used in admin: event_detail, crew_manage, members) */
.panel-header-dark {
    background: #0d1117; padding: 20px 24px; border-radius: 8px 8px 0 0; color: #fff;
}
.panel-header-dark h1,
.panel-header-dark h2,
.panel-header-dark h3 { margin: 0; font-size: 1.3rem; color: #fff; }
.panel-body {
    background: #f9f9f9; padding: 24px;
    border: 1px solid #eee; border-top: none; border-radius: 0 0 8px 8px;
}

/* --------------------------------------------------------------------------
   0. PAGE STRUCTURE UTILITIES
   -------------------------------------------------------------------------- */
.page-grid-wrap {
    margin-top: var(--page-top-margin);
}
.page-back-bar {
    width: var(--sidebar-left, 250px);
    padding-bottom: 8px;
}
.page-back-link {
    text-decoration: none;
    color: var(--sidebar-link-color);
    font-size: 0.88rem;
    line-height: 1;
}
.page-back-link:hover {
    color: var(--primary-color);
}

/* Quick links — sidebar contextual nav */
.quick-links {
    list-style: none;
    padding: 0;
    margin: 0;
    line-height: 2.4;
    font-size: 0.9rem;
}
.quick-links a {
    text-decoration: none;
    color: var(--sidebar-link-color);
}
.quick-links a:hover {
    color: var(--primary-color);
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--page-bg); /* Now connected to Style Editor */
    color: #333;
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   2. GLOBAL LAYOUT
   -------------------------------------------------------------------------- */
.container {
    max-width: 98%;
    margin: 0 auto;
    padding: 20px;
}

/* 3-Column "Holy Grail" Grid */
.main-grid {
    display: grid;
    /* Uses dynamic variables, defaults to 250px/200px if missing */
    grid-template-columns: var(--sidebar-left, 250px) 1fr var(--sidebar-right, 200px); 
    gap: 20px;
    align-items: start;
}

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

/*
.main-content-wrapper { margin-top: 20px; }
*/
/*
.main-content-wrapper {
    padding-top: 80px; /* Adjust this number to match your header's height */
 /*   padding-bottom: 40px;
}*/

.main-content-wrapper {
    max-width: var(--layout-width, 1200px); /* Now dynamic! */
    margin: 10px auto 40px !important; /* Top margin is the first number */
    padding: 0 20px !important;
    position: relative;
    z-index: 1;
    transition: max-width 0.2s; /* Smooth sliding in editor */
}

/* --------------------------------------------------------------------------
   3. SHARED COMPONENTS (Cards, Buttons, Forms, Modals)
   -------------------------------------------------------------------------- */
.card, .sidebar-widget {
    background: white;
    padding: 20px;
    border-radius: var(--card-radius); /* Now connected to Style Editor */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

/* -- Buttons -- */
.btn-primary, .btn-auth {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    display: inline-block;
    transition: opacity 0.2s;
}

.btn-primary:hover, .btn-auth:hover { opacity: 0.9; }

.btn-small {
    padding: 8px 12px;
    font-size: 0.9rem;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    border: none;
    text-align: center;
}

/* -- Forms -- */
.form-control, .form-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1rem;
    margin-bottom: 15px;
}

.form-label { font-weight: bold; display: block; margin-bottom: 5px; color: #333; }
.form-text { font-size: 0.85rem; color: #999; margin-top: 5px; }

/* -- Alerts -- */
.alert-danger, .error-msg {
    color: #721c24; background-color: #f8d7da; border-color: #f5c6cb;
    padding: 10px; margin-bottom: 15px; border-radius: 4px; text-align: center;
}

.alert-success, .success-msg {
    color: #155724; background-color: #d4edda; border-color: #c3e6cb;
    padding: 10px; margin-bottom: 15px; border-radius: 4px; text-align: center;
}

/* -- Modals (Shared) -- */
.modal-overlay, .crop-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 9999;
    display: flex; justify-content: center; align-items: center;
    backdrop-filter: blur(3px);
}

.modal-content, .modal-content-crop {
    background: white; padding: 25px; border-radius: 12px;
    width: 90%; max-width: 500px;
    position: relative; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.close-modal, .close-btn {
    position: absolute; top: 10px; right: 15px;
    font-size: 24px; cursor: pointer; color: #999;
}
.close-modal:hover, .close-btn:hover { color: #333; }

/* --------------------------------------------------------------------------
   4. DATA TABLES & BADGES
   -------------------------------------------------------------------------- */
.proj-table, .wl-table { 
    width: 100%; border-collapse: collapse; font-size: 0.9rem; 
}
.proj-table th, .wl-table th { 
    background: #f8f9fa; color: #555; font-weight: 600; 
    text-align: left; padding: 12px 10px; border-bottom: 2px solid #ddd; 
}
.proj-table td, .wl-table td { 
    padding: 12px 10px; border-bottom: 1px solid #eee; vertical-align: middle; 
}
.proj-table tr:hover, .wl-table tr:hover { background: #fafafa; }

.status-badge, .badge-status { 
    padding: 4px 8px; border-radius: 12px; font-size: 0.75rem; 
    font-weight: bold; text-transform: uppercase; white-space: nowrap; 
}
.st-done, .status-done { background: #d4edda; color: #155724; }
.st-todo, .status-todo { background: #cce5ff; color: #004085; }
.status-overdue { background: #f8d7da; color: #721c24; }

.cost-badge { 
    background: #fff3cd; color: #856404; padding: 2px 6px; 
    border-radius: 4px; font-size: 0.8rem; font-weight: bold; 
}

/* --------------------------------------------------------------------------
   5. NAVIGATION BAR
   -------------------------------------------------------------------------- */
.sticky-nav-bar {
    background-color: #000; width: 100%; padding: 0; border-bottom: 2px solid #333;
    position: sticky; top: 0; z-index: 1000; box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.nav-flex-container {
    display: flex; align-items: center;
    width: 100%; height: 40px; padding: 0 20px; box-sizing: border-box;
}

.nav-left  { flex: 1; display: flex; align-items: center; gap: 10px; }
.nav-center { flex: 2; display: flex; justify-content: center; align-items: center; }
.nav-right  { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 15px; }

.nav-menu-list { list-style: none; padding: 0; margin: 0; display: flex; gap: 30px; }
.nav-menu-list a {
    font-family: 'Pacifico', cursive; font-size: 1.2rem; color: #ccc;
    text-decoration: none; transition: color 0.3s, text-shadow 0.3s;
}
.nav-menu-list a:hover { color: #fff; text-shadow: 0 0 5px red; }

.nav-chim-icon { height: 50px; width: auto; display: block; }

.admin-secret-link { font-family: sans-serif; font-weight: bold; font-size: 0.9rem; color: #666; text-decoration: none; letter-spacing: 1px; }
.admin-link-inactive { cursor: default; opacity: 0.5; color: inherit; text-decoration: none; }
.nav-back-link {
    font-size: 1.2rem;
    line-height: 1;
    color: #888 !important;
    text-decoration: none !important;
    font-weight: 600;
    transition: color 0.2s, text-shadow 0.2s;
}
.nav-back-link:hover { color: #fff !important; text-shadow: 0 0 6px #fff; }

/* Preview mode controls */
.nav-preview-exit {
    font-size: 0.72rem; background: #e65100; color: #fff;
    padding: 3px 8px; border-radius: 4px; text-decoration: none; font-weight: 600;
}
.nav-preview-wrap { position: relative; display: inline-block; }
.nav-preview-btn {
    font-size: 0.72rem; background: #f0f0f0; color: #555;
    padding: 3px 8px; border-radius: 4px; text-decoration: none; font-weight: 600;
}
.nav-preview-menu {
    display: none; position: absolute; right: 0; top: 110%;
    background: #fff; border: 1px solid #ddd; border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); min-width: 130px; z-index: 9999; overflow: hidden;
}
.nav-preview-menu.open { display: block; }
.nav-preview-item {
    display: block; padding: 8px 14px; font-size: 0.82rem;
    color: #333; text-decoration: none; border-bottom: 1px solid #f2f2f2;
}
.nav-preview-item:last-child { border-bottom: none; }
.nav-preview-item:hover { background: #f8f9fa; }

/* Coming-soon nav link & modal */
.nav-coming-soon-link { cursor: pointer; opacity: 0.45; user-select: none; }
.nav-coming-soon-link:hover { opacity: 0.7; }

.coming-soon-modal {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.55); z-index: 9999;
    align-items: center; justify-content: center;
}
.coming-soon-modal.active { display: flex; }
.coming-soon-modal-inner {
    background: #fff; border-radius: 12px; padding: 40px 48px;
    text-align: center; max-width: 360px; width: 90%;
    position: relative; box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.coming-soon-modal-close {
    position: absolute; top: 12px; right: 16px;
    background: none; border: none; font-size: 1.4rem;
    color: #999; cursor: pointer; line-height: 1;
}

/* --------------------------------------------------------------------------
   6. TOP BANNER
   -------------------------------------------------------------------------- */
.top-banner-container { position: relative; width: 100%; overflow: hidden; background-color: #000; }
.banner-large { height: 300px; }
.banner-small { height: 255px; }

.banner-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-position: center bottom; background-repeat: no-repeat; background-size: cover;
}
#banner-fg { z-index: 2; opacity: 1; transition: opacity 1s ease-in-out; }
#banner-bg { z-index: 1; }

@keyframes fadeOutText { 0% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
.banner-content {
    position: relative; z-index: 3; height: 100%; display: flex; flex-direction: column;
    justify-content: center; align-items: center; text-align: center; color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8); pointer-events: none;
}
.banner-content h1 {
    font-family: 'Pacifico', cursive; font-size: 5rem; margin: 0; line-height: 1;
    animation: fadeOutText 6s ease-in-out forwards;
}
.banner-sail-id {
    position: absolute; bottom: 10px; left: 16px; z-index: 3;
    color: rgba(255,255,255,0.75); font-size: 0.8rem; font-weight: 600;
    letter-spacing: 0.05em; text-shadow: 1px 1px 3px rgba(0,0,0,0.6);
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   7. CREW DASHBOARD
   -------------------------------------------------------------------------- */
.welcome-banner { 
    background: white; padding: 25px; border-radius: 8px; margin-bottom: 25px; 
    border-left: 5px solid var(--primary-color); box-shadow: 0 2px 5px rgba(0,0,0,0.05); 
}
.module-grid { 
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; 
}
.tool-card {
    background: white; padding: 25px; border-radius: 12px; text-align: center; 
    text-decoration: none; color: #333; display: flex; flex-direction: column; align-items: center;
    border: 1px solid #eee; transition: transform 0.2s, box-shadow 0.2s; height: 100%; box-sizing: border-box;
}
.tool-card:hover { transform: translateY(-4px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); border-color: var(--primary-color); }
.tool-icon { font-size: 2.5rem; margin-bottom: 15px; }
.tool-title { font-weight: bold; font-size: 1.1rem; margin-bottom: 8px; color: var(--primary-color); }
.tool-desc { font-size: 0.85rem; color: #666; line-height: 1.4; }
.tool-card.disabled { opacity: 0.6; cursor: default; }

.user-widget-avatar { 
    width: 100px; height: 100px; border-radius: 50%; object-fit: cover; 
    border: 4px solid #f8f9fa; box-shadow: 0 2px 5px rgba(0,0,0,0.1); margin-bottom: 10px; 
}

/* --------------------------------------------------------------------------
   8. MEDIA & WORKLIST GALLERIES
   -------------------------------------------------------------------------- */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.wl-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 10px; margin-top: 15px; }

.media-card {
    background: white; border-radius: 8px; overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); transition: transform 0.2s;
}
.media-card:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.15); }
.media-preview { height: 180px; background: #000; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.media-preview img, .gallery-item { width: 100%; height: 100%; object-fit: cover; }
.media-info { padding: 15px; }

.uploader-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 0.85rem; color: #666; }
.uploader-avatar, .note-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; border: 1px solid #eee; }

/* Tabs */
.tab-container { display: flex; margin-bottom: 0; }
.tab-btn { 
    padding: 10px 20px; cursor: pointer; background: #f8f9fa; border: 1px solid #ddd; border-bottom: none; 
    margin-right: 5px; border-radius: 5px 5px 0 0; font-size: 0.9rem; 
}
.tab-btn.active { background: var(--primary-color); color: white; border-color: var(--primary-color); }
.form-section { display: none; padding: 20px; border: 1px solid #ddd; background: #fff; border-radius: 0 5px 5px 5px; }
.form-section.active { display: block; }

/* --- THUMBNAIL GRIDS (Photos & Videos) --- */

.thumbnail-grid {
    display: grid;
    /* Reduced min-width from 200px to 150px */
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px; /* Optional: Reduced gap slightly */
    margin-top: 20px;
}

.grid-image, .video-grid-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
}

.grid-image:hover, .video-grid-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.15);
}

.grid-image img {
    width: 100%;
    /* Reduced height from 200px to 150px to match width */
    height: 150px; 
    object-fit: cover; 
    display: block;
}

.thumb-caption {
    padding: 8px; /* Reduced padding slightly */
    text-align: center;
    font-weight: bold;
    font-size: 0.85rem; /* Slightly smaller text */
    color: #555;
    background: #fff;
    border-top: 1px solid #eee;
}

/* Video specific tweaks */
.video-thumb-container {
    position: relative;
    /* Reduced height from 150px to 120px */
    height: 120px; 
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-thumb-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.video-grid-item:hover .video-thumb-media {
    opacity: 1;
}

.video-play-icon {
    position: absolute;
    font-size: 2.5rem; /* Slightly smaller icon */
    color: rgba(255,255,255,0.9);
    text-shadow: 0 2px 5px rgba(0,0,0,0.5);
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   9. PROFILE & MISC
   -------------------------------------------------------------------------- */
.avatar-wrapper {
    position: relative; width: 100%; max-width: 200px; aspect-ratio: 1/1;
    margin: 0 auto 15px auto; border-radius: 50%; overflow: hidden;
    border: 4px solid #fff; box-shadow: 0 4px 10px rgba(0,0,0,0.1); cursor: pointer;
}
.avatar-wrapper img { width: 100%; height: 100%; object-fit: cover; }
.avatar-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); color: white; display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.2s; font-weight: bold;
}
.avatar-wrapper:hover .avatar-overlay { opacity: 1; }

.img-container { max-height: 400px; margin-bottom: 20px; overflow: hidden; }
.img-container img { max-width: 100%; }

.lightbox {
    position: fixed; inset: 0; background: rgba(0,0,0,0.95); display: none; 
    align-items: center; justify-content: center; flex-direction: column; z-index: 20000;
}
.lightbox.open { display: flex !important; }
.lightbox img { max-width: 90vw; max-height: 80vh; border: 2px solid #333; }

.auth-card { max-width: 520px; margin: 80px auto 60px; padding: 40px; }

footer {
    text-align: center; padding: 2rem 0; font-size: 0.9rem; color: #666; 
    border-top: 1px solid #ddd; margin-top: 40px; background: var(--page-bg);
}

/* --------------------------------------------------------------------------
   10. ADMIN DASHBOARD & TABLES
   -------------------------------------------------------------------------- */
.dashboard-container { max-width: 1200px; margin: 0 auto; padding: 40px 20px; }
.admin-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }

.section-title { 
    color: #555; font-size: 1.2rem; text-transform: uppercase; letter-spacing: 1px; 
    margin-top: 40px; margin-bottom: 15px; border-left: 5px solid var(--primary-color); padding-left: 10px; 
}

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

.admin-card {
    background: white; padding: 25px; border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05); text-decoration: none; color: inherit; 
    transition: transform 0.2s, box-shadow 0.2s; display: flex; flex-direction: column; align-items: center; text-align: center;
}
.admin-card:hover { transform: translateY(-5px); box-shadow: 0 8px 15px rgba(0,0,0,0.1); }
.admin-card .icon { font-size: 3rem; margin-bottom: 15px; }
.admin-card .title { font-size: 1.25rem; font-weight: bold; margin-bottom: 10px; color: var(--primary-color); }
.admin-card .desc { font-size: 0.9rem; color: #666; line-height: 1.4; }

.admin-table { width: 100%; border-collapse: collapse; margin-top: 10px; background: white; }
.admin-table th { background: #f8f9fa; text-align: left; padding: 12px; border-bottom: 2px solid #ddd; color: #555; }
.admin-table td { padding: 12px; border-bottom: 1px solid #eee; vertical-align: middle; }
.admin-table tr:hover { background: #fafafa; }

/* Status Badges */
.badge-admin { background: #cce5ff; color: #004085; }
.badge-crew { background: #e2e3e5; color: #383d41; }
.badge-active { background: #d4edda; color: #155724; }
.badge-inactive { background: #f8d7da; color: #721c24; }
.badge-planning { background: #fff3cd; color: #856404; }

/* --------------------------------------------------------------------------
   11. ADMIN MODULES (Photo, Telemetry, Video)
   -------------------------------------------------------------------------- */
/* Forms & Previews */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.full-width { grid-column: span 2; }
.create-input { border: 1px solid #ddd; border-radius: 3px; padding: 8px; width: 100%; box-sizing: border-box; margin-top: 5px; }

.photo-preview { margin-top: 10px; padding: 10px; border: 1px solid #eee; border-radius: 4px; background: #fafafa; text-align: center; }
.photo-preview img { max-width: 100%; height: auto; border-radius: 4px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.thumb-img, .thumb-placeholder { height: 35px; width: 35px; object-fit: cover; border-radius: 3px; display: block; margin: 0 auto; }
.thumb-placeholder { background: #eee; color: #bbb; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 1.1rem; }

/* Buttons */
.btn-secondary { background: #6c757d; color: white; padding: 10px 20px; text-decoration: none; border-radius: 4px; display: inline-block; border: none; cursor: pointer; font-size: 1rem; }
.btn-secondary:hover { background: #5a6268; }
.btn-danger { background: #dc3545; color: white; border: none; padding: 5px 10px; border-radius: 4px; cursor: pointer; }
.btn-danger:hover { background: #c82333; }
.btn-action { background: var(--primary-color); color: white; padding: 10px 20px; text-decoration: none; border-radius: 4px; display: inline-block; border: none; cursor: pointer; font-size: 1rem; width: 100%; text-align: center; }
.btn-action:hover { opacity: 0.9; }
.btn-purple { background: #6f42c1; color: white; }
.btn-green { background: #28a745; color: white; }

/* Photo Manager */
.album-list { margin-top: 30px; border-top: 2px solid #eee; padding-top: 20px; }
.album-item { padding: 10px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; }
.photo-manager-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; }
.photo-manager-card { background: white; padding: 5px; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); cursor: pointer; transition: transform 0.2s; position: relative; }
.photo-manager-card:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.2); }
.photo-manager-card img { width: 100%; height: 150px; object-fit: cover; border-radius: 3px; display: block; }
.file-name-label { font-size: 0.75rem; color: #666; text-align: center; margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Dark Mode Editor */
.editor-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.95); z-index: 2000; align-items: center; justify-content: center; }
.editor-content { background: #222; padding: 20px; border-radius: 8px; width: 95%; max-width: 900px; height: 90vh; display: flex; flex-direction: column; }
.editor-canvas { flex-grow: 1; background: black; overflow: hidden; position: relative; display: flex; align-items: center; justify-content: center; border: 1px solid #333; }
.editor-canvas img { max-width: 100%; max-height: 100%; display: block; }
.editor-toolbar { padding-top: 15px; display: flex; gap: 10px; justify-content: center; border-top: 1px solid #444; margin-top: 10px; flex-wrap: wrap; }

/* Charts & Telemetry */
.chart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 2px solid #eee; padding-bottom: 20px; }
.chart-controls { background: #f8f9fa; padding: 15px; border-radius: 8px; display: flex; gap: 20px; align-items: center; margin-bottom: 30px; flex-wrap: wrap; border: 1px solid #eee; }
.chart-wrapper { position: relative; height: 700px; width: 100%; }
.chart-wrapper-sm { position: relative; height: 500px; width: 100%; }
.analysis-tips { margin-top: 20px; padding: 20px; background: #fafafa; border-radius: 8px; border-left: 4px solid var(--primary-color); }
.stat-box { background: #eee; padding: 20px; border-radius: 8px; margin-bottom: 30px; text-align: center; }
.stat-item { font-size: 1.2rem; margin-bottom: 10px; }

/* Stats Grid */
.stat-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 30px; }
@media(max-width: 768px) { .stat-grid-3 { grid-template-columns: 1fr; } }
.stat-card-lg { background: white; padding: 20px; border-radius: 8px; text-align: center; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.stat-number-lg { font-size: 2.5rem; font-weight: bold; color: var(--primary-color); display: block; }
.stat-label-lg { color: #666; text-transform: uppercase; font-size: 0.85rem; letter-spacing: 1px; }

/* Video & Imports */
.video-thumb-cell { width: 120px; background: #000; text-align: center; border-radius: 4px; overflow: hidden; }
.video-thumb-img { max-width: 100%; height: auto; display: block; opacity: 0.8; }
.video-type-badge { display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: bold; text-transform: uppercase; }
.type-local { background: #e2e6ea; color: #333; }
.type-youtube { background: #ffebee; color: #c62828; }
.type-vimeo { background: #e3f2fd; color: #0277bd; }
.console-box { background: #1e1e1e; color: #00ff00; padding: 15px; border-radius: 4px; font-family: monospace; font-size: 0.9rem; max-height: 300px; overflow-y: auto; margin-bottom: 20px; }

/* --- ADMIN: STYLE EDITOR --- */
.preview-box { background: #e9ecef; padding: 40px; border-radius: 8px; display: flex; justify-content: center; align-items: center; min-height: 200px; border: 1px dashed #adb5bd; }
.preview-card { background: #ffffff; padding: 25px; width: 100%; max-width: 300px; border-radius: var(--card-radius); box-shadow: 0 10px 25px rgba(0,0,0,0.15); text-align: center; transition: border-radius 0.2s; }
.preview-btn { background: var(--primary-color); color: white; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; margin-top: 15px; font-size: 0.9rem; transition: background-color 0.2s; }

/* --- PUBLIC CREW LIST (crew.php) --- */

.crew-grid-avatar {
    width: 120px;  /* Reduced from 150px */
    height: 120px; /* Reduced from 150px */
    margin: 0 auto 10px auto; 
    border-radius: 50%; 
    overflow: hidden; 
    border: 3px solid #f0f0f0; /* Slightly thinner border */
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    position: relative; 
    transition: transform 0.2s;
}

.crew-grid-avatar img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
}

/* Edit Overlay (Only appears if class 'editable' is present) */
.crew-grid-avatar.editable { 
    cursor: pointer; 
    border-color: var(--primary-color, #007bff); 
}

.crew-grid-avatar.editable:hover { 
    transform: scale(1.05); 
}

.edit-overlay {
    position: absolute; 
    bottom: 0; 
    left: 0; 
    width: 100%;
    background: rgba(0, 123, 255, 0.8); 
    color: white;
    font-size: 0.8rem; 
    padding: 5px 0;
    display: none; 
}

.crew-grid-avatar.editable:hover .edit-overlay { 
    display: block; 
}

/* Profile logout link */
.logout-link { color: #c0392b; text-decoration: none; font-weight: bold; }
.logout-link:hover { opacity: 0.8; }

/* text-center utility (display-level) */
.text-center { text-align: center; }

/* --------------------------------------------------------------------------
   12. SIDEBAR SORT MENUS
   -------------------------------------------------------------------------- */
.sort-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sort-link {
    display: block;
    padding: 10px 15px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #555;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.sort-link:hover {
    background: #f8f9fa;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.sort-link.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Visibility toggle buttons (event_log, videos/index) */
.btn-toggle {
    font-size: 0.7rem; padding: 2px 8px; border-radius: 4px;
    cursor: pointer; font-weight: 600; white-space: nowrap; border-width: 1px; border-style: solid;
}
.btn-toggle-live   { background: #d4edda; color: #155724; border-color: #c3e6cb; }
.btn-toggle-hidden { background: #f8d7da; color: #721c24; border-color: #f5c6cb; }

/* Add this to admin/telemetry/telemetry_map.php */
.leaflet-tooltip.map-label-start {
    background-color: #28a745;
    color: white;
    border: none;
    font-weight: bold;
}
/* --------------------------------------------------------------------------
   EVENT VIEW & CREW SHARED COMPONENTS
   -------------------------------------------------------------------------- */

/* Utility: hide elements (toggled by JS) */
.hidden { display: none !important; }

/* Ghost button — no background, text only, used for inline actions */
.btn-ghost-sm {
    background: none; border: none; cursor: pointer;
    font-size: 0.8rem; color: #aaa; padding: 0; line-height: 1;
}
.btn-ghost-sm:hover { color: #555; }

/* Base button */
.btn {
    padding: 8px 16px; font-size: 0.9rem; font-weight: 600;
    border-radius: 6px; cursor: pointer; display: inline-block;
    text-decoration: none; border: none;
}
/* Small button */
.btn-sm {
    padding: 6px 14px; font-size: 0.85rem; font-weight: 600;
    border-radius: 6px; cursor: pointer; display: inline-block; text-decoration: none; border: none;
}

/* 2-column form grid */
.form-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}

/* Checkbox tile — labelled checkbox with coloured background */
.checkbox-tile {
    cursor: pointer; display: flex; align-items: center; gap: 8px;
    padding: 12px; border-radius: 6px; border: 1px solid transparent;
}
.checkbox-tile span { font-weight: 600; font-size: 0.9rem; }
.checkbox-tile-pink  { background: #fff0f3; border-color: #ffccd5; }
.checkbox-tile-pink span  { color: #d63384; }
.checkbox-tile-green { background: #e8f5e9; border-color: #c3e6cb; }
.checkbox-tile-green span { color: #155724; }

/* Pinned thread row in sidebar */
.pinned-thread-row {
    padding: 7px 0; border-bottom: 1px solid #f2f2f2;
}

.mb-20 { margin-bottom: 20px; }

/* Cover photo banner */
.ev-cover-banner {
    width: 100%; max-height: 320px; object-fit: cover;
    border-radius: 8px; margin-bottom: 20px; display: block;
}

/* Title row — name + type badge + status badge on one line */
.ev-title-row {
    display: flex; align-items: flex-start; gap: 10px;
    flex-wrap: wrap; margin-bottom: 10px;
}
.ev-title-row h1 { margin: 0; font-size: 1.5rem; color: #222; flex: 1; }

/* Small pill badges on event title */
.ev-type-badge {
    font-size: 0.7rem; font-weight: 700;
    padding: 3px 9px; border-radius: 10px; margin-top: 5px;
}
.ev-type-race   { background: #ffc107; color: #333; }
.ev-type-cruise { background: #e2e6ea; color: #666; }
.ev-status-badge {
    font-size: 0.7rem; font-weight: 700;
    padding: 3px 9px; border-radius: 10px;
    color: #fff; margin-top: 5px;
}

/* RSVP invite banner */
.ev-rsvp-banner {
    display: flex; gap: 10px; align-items: center;
    background: #fff8e1; border: 1px solid #ffe082;
    border-radius: 8px; padding: 12px 16px; margin-bottom: 16px;
}
.ev-rsvp-banner span { font-size: 0.88rem; color: #856404; flex: 1; }

/* Hidden-event warning strip */
.ev-hidden-warning {
    background: #fff3cd; border: 1px solid #ffc107;
    border-radius: 6px; padding: 8px 14px;
    margin-bottom: 16px; font-size: 0.85rem; color: #856404;
}

/* Meta strip — date / distance / result / counts */
.ev-meta-strip {
    display: flex; flex-wrap: wrap; gap: 18px;
    margin-bottom: 18px; font-size: 0.88rem; color: #666;
}
.ev-meta-strip span { display: flex; align-items: center; gap: 5px; }

/* Action bar — Race Map / Photos / Results buttons */
.ev-action-bar {
    display: flex; flex-wrap: wrap; gap: 10px;
    margin-bottom: 24px; padding-bottom: 18px;
    border-bottom: 1px solid #eee;
}
.ev-action-bar a {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 7px;
    font-size: 0.88rem; font-weight: 600; text-decoration: none;
}

/* Thread list rows */
.thread-row {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 0; border-bottom: 1px solid #f2f2f2;
}
.thread-meta { font-size: 0.78rem; color: #aaa; margin-top: 2px; }

/* Small crew avatar (circle with status-color border) */
.crew-avatar-sm {
    width: 36px; height: 36px; border-radius: 50%;
    object-fit: cover; border: 2px solid #ddd;
}

.leaflet-tooltip.map-label-finish {
    background-color: #dc3545; /* Red */
    color: white;
    border: none;
    font-weight: bold;
}

/* --------------------------------------------------------------------------
   RACING — race card grid (racing/index.php)
   -------------------------------------------------------------------------- */
.racing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 10px;
}
.race-card {
    background: #fff;
    border-radius: var(--card-radius);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}
.race-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.13);
}
.race-cover {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
    background: #eee;
}
.race-cover-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #1a3a5c 0%, #0d6efd33 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}
.race-body {
    padding: 18px 20px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.race-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 4px;
    line-height: 1.3;
}
.race-dates { font-size: 0.82rem; color: #888; margin-bottom: 12px; }
.race-stats { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.race-stat { display: flex; flex-direction: column; gap: 1px; }
.race-stat-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #aaa;
    font-weight: 600;
}
.race-stat-value { font-size: 1rem; font-weight: 700; color: #222; }
.race-result-badge {
    display: inline-block;
    background: #ffc107;
    color: #333;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
}
.race-media-counts {
    display: flex;
    gap: 12px;
    font-size: 0.82rem;
    color: #666;
    margin-bottom: 16px;
}
.race-media-counts span { display: flex; align-items: center; gap: 4px; }
.race-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid #f0f0f0;
}
.race-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: 5px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.15s;
}
.race-btn:hover { opacity: 0.8; }
.race-btn-photos { background: var(--primary-color); color: white; }
.race-btn-videos { background: #222; color: white; }
.race-btn-results { background: #f0f0f0; color: #555; }

/* --------------------------------------------------------------------------
   VIDEOS — gallery grid & modal player (videos/index.php)
   -------------------------------------------------------------------------- */
.video-modal-content {
    position: relative;
    background: #000;
    border-radius: 10px;
    width: 90vw;
    max-width: 1100px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}
.video-modal-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    background: #111;
    padding: 6px 12px;
    flex-shrink: 0;
}
.video-player-container {
    flex: 1;
    background: #000;
    position: relative;
    overflow: hidden;
}
.video-player-container video,
.video-player-container iframe { width: 100%; height: 100%; display: block; }
.video-close-btn {
    font-size: 1.6rem; line-height: 1;
    color: #aaa; cursor: pointer;
    padding: 2px 6px;
    transition: color 0.2s;
    background: none; border: none;
}
.video-close-btn:hover { color: #fff; }
.video-footer-info {
    background: #111;
    color: #ccc;
    font-size: 0.85rem;
    padding: 8px 16px;
    display: none;
}
.pip-map-container {
    position: absolute;
    bottom: 20px; right: 20px;
    width: 180px; height: 140px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.2);
    box-shadow: 0 2px 10px rgba(0,0,0,0.6);
    display: none;
    z-index: 50;
}
.pip-map-container iframe { width: 100%; height: 100%; border: none; }

/* --------------------------------------------------------------------------
   PHOTOS — mosaic grid (photos/mosaic.php)
   -------------------------------------------------------------------------- */
.mosaic-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important;
    grid-auto-rows: 120px !important;
    gap: 10px !important;
    grid-auto-flow: dense !important;
}
.tile {
    position: relative; overflow: hidden; border-radius: 8px;
    background: #f5f5f5; display: block; height: 100%; width: 100%;
    transition: transform 0.2s;
    cursor: pointer;
}
.tile:hover { transform: scale(1.02); z-index: 5; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.span-2x2 { grid-column: span 2 !important; grid-row: span 2 !important; z-index: 10; }