/* ============================================
   Quoi faire ce soir — Main Stylesheet
   ============================================ */

/* ---- CSS Custom Properties (Theme) ---- */
:root {
    /* Brand colors - Navy */
    --primary-color: #1B2A4A;
    --primary-light: #2C4270;
    --primary-dark: #0F1A30;
    --primary-hover: #243660;

    /* Accent */
    --accent-color: #3B82F6;
    --accent-light: #60A5FA;

    /* Backgrounds */
    --background-color: #FFFFFF;
    --background-secondary: #F8F9FC;
    --background-card: #FFFFFF;

    /* Text */
    --text-primary: #1A1A2E;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --text-inverse: #FFFFFF;

    /* Borders */
    --border-color: #E2E8F0;
    --border-light: #F1F5F9;

    /* Sidebar */
    --sidebar-width: 200px;
    --sidebar-bg: var(--primary-color);
    --sidebar-text: #CBD5E1;
    --sidebar-active: var(--accent-color);
    --sidebar-hover: rgba(255, 255, 255, 0.08);

    /* Topbar */
    --topbar-height: 64px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;

    /* Category colors */
    --cat-musique: #E74C3C;
    --cat-bar: #9B59B6;
    --cat-restaurant: #E67E22;
    --cat-sport: #27AE60;
    --cat-art: #3498DB;
    --cat-festival: #F1C40F;
    --cat-pleinair: #1ABC9C;
    --cat-prive: #7F8C8D;
    --cat-famille: #E91E63;
    --cat-autre: #95A5A6;
}

/* ---- Dark Mode ---- */
[data-theme="dark"] {
    --background-color: #0F172A;
    --background-secondary: #1E293B;
    --background-card: #1E293B;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --border-color: #334155;
    --border-light: #1E293B;
    --sidebar-bg: #0B1120;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

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

a:hover {
    text-decoration: underline;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

/* ---- Layout ---- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition-normal);
}

.main-content {
    flex: 1;
    padding: 24px;
    margin-top: var(--topbar-height);
}

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-normal), width var(--transition-normal);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand .brand-icon {
    width: 36px;
    height: 36px;
    background: var(--accent-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    font-size: 14px;
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1.2;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 16px 12px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-height: 44px; /* Touch target */
    text-decoration: none;
    font-size: 14px;
    user-select: none;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #FFFFFF;
    text-decoration: none;
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--sidebar-active);
    font-weight: 500;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.nav-item .nav-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--accent-color);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* ---- Topbar ---- */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--background-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    z-index: 900;
    transition: left var(--transition-normal), background-color var(--transition-normal);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.mobile-menu-btn:hover {
    background: var(--background-secondary);
}

.search-container {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-container input {
    width: 100%;
    min-width: 300px;
    padding: 10px 16px 10px 42px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--background-secondary);
    color: var(--text-primary);
    font-size: 14px;
    min-height: 44px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-container input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.search-container input::placeholder {
    color: var(--text-muted);
}

.search-container .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--background-secondary);
    color: var(--text-primary);
}

.notification-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    position: relative;
    transition: all var(--transition-fast);
}

.notification-btn:hover {
    background: var(--background-secondary);
    color: var(--text-primary);
}

.notification-btn .notif-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #EF4444;
    border-radius: 50%;
    border: 2px solid var(--background-color);
}

/* User avatar dropdown */
.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: none;
    cursor: pointer;
    min-height: 44px;
    transition: all var(--transition-fast);
    color: var(--text-primary);
}

.user-menu-trigger:hover {
    background: var(--background-secondary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.user-menu-trigger .user-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.user-menu-trigger .chevron {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.user-menu.open .chevron {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
    z-index: 1100;
}

.user-menu.open .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: background var(--transition-fast);
    min-height: 44px;
}

.user-dropdown-item:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.user-dropdown-item:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.user-dropdown-item:hover {
    background: var(--background-secondary);
}

.user-dropdown-item i {
    width: 18px;
    text-align: center;
    color: var(--text-secondary);
}

.dropdown-divider {
    border-top: 1px solid var(--border-color);
    margin: 4px 0;
}

/* ---- Page Header ---- */
.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ---- KPI Metric Cards ---- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-fast), background-color var(--transition-normal);
}

.metric-card:hover {
    box-shadow: var(--shadow-md);
}

.metric-card .metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.metric-card .metric-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.metric-card .metric-change {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
}

.metric-change.positive {
    background: rgba(39, 174, 96, 0.1);
    color: #27AE60;
}

.metric-change.negative {
    background: rgba(231, 76, 60, 0.1);
    color: #E74C3C;
}

.metric-card .metric-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.metric-card .metric-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ---- Section Cards ---- */
.section-card {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    transition: background-color var(--transition-normal);
}

.section-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.section-card .card-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.section-card .card-body {
    padding: 20px;
}

/* ---- Map ---- */
.map-container {
    width: 100%;
    height: 500px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

#event-map {
    width: 100%;
    height: 100%;
}

.map-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--background-card);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-height: 36px;
    user-select: none;
}

.filter-chip:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.filter-chip.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.filter-chip .chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ---- Chart Placeholders ---- */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.chart-container {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.chart-container .chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.chart-container .chart-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.chart-placeholder {
    width: 100%;
    height: 300px;
    background: var(--background-secondary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* ---- Top 10 List ---- */
.top10-list {
    list-style: none;
}

.top10-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.top10-item:last-child {
    border-bottom: none;
}

.top10-rank {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--background-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.top10-item:nth-child(1) .top10-rank {
    background: #F59E0B;
    color: white;
}

.top10-item:nth-child(2) .top10-rank {
    background: #94A3B8;
    color: white;
}

.top10-item:nth-child(3) .top10-rank {
    background: #CD7F32;
    color: white;
}

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

.top10-info .top10-title {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top10-info .top10-venue {
    font-size: 12px;
    color: var(--text-muted);
}

.top10-count {
    text-align: right;
    flex-shrink: 0;
}

.top10-count .count-number {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-color);
}

.top10-count .count-label {
    font-size: 11px;
    color: var(--text-muted);
}

.top10-bar {
    width: 80px;
    height: 6px;
    background: var(--background-secondary);
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}

.top10-bar .bar-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--accent-color);
    transition: width var(--transition-normal);
}

/* ---- Activity Feed ---- */
.activity-feed {
    list-style: none;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.activity-icon.rsvp { background: rgba(59, 130, 246, 0.1); color: var(--accent-color); }
.activity-icon.checkin { background: rgba(39, 174, 96, 0.1); color: #27AE60; }
.activity-icon.event { background: rgba(155, 89, 182, 0.1); color: #9B59B6; }

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-content .activity-text {
    font-size: 14px;
    line-height: 1.4;
}

.activity-content .activity-text strong {
    font-weight: 600;
}

.activity-content .activity-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ---- Event Creation Form ---- */
.form-section {
    margin-bottom: 24px;
}

.form-section-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group label .required {
    color: #EF4444;
}

.form-control {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--background-color);
    color: var(--text-primary);
    font-size: 14px;
    min-height: 44px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748B' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    min-height: 44px;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-primary:hover {
    background: #2563EB;
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--background-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-danger {
    background: #EF4444;
    color: white;
}

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

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    min-height: 36px;
}

.btn-block {
    width: 100%;
}

/* ---- RSVP Buttons ---- */
.rsvp-buttons {
    display: flex;
    gap: 8px;
}

.btn-interesse {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
}

.btn-interesse:hover, .btn-interesse.active {
    background: var(--accent-color);
    color: white;
}

.btn-jyvais {
    background: rgba(39, 174, 96, 0.1);
    color: #27AE60;
    border: 1px solid #27AE60;
}

.btn-jyvais:hover, .btn-jyvais.active {
    background: #27AE60;
    color: white;
}

.btn-checkin {
    background: rgba(155, 89, 182, 0.1);
    color: #9B59B6;
    border: 1px solid #9B59B6;
}

.btn-checkin:hover, .btn-checkin.active {
    background: #9B59B6;
    color: white;
}

/* ---- Settings Panel ---- */
.settings-section {
    margin-bottom: 32px;
}

.settings-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
    gap: 16px;
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-info {
    flex: 1;
}

.setting-info .setting-label {
    font-size: 14px;
    font-weight: 500;
}

.setting-info .setting-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border-color);
    border-radius: 26px;
    transition: var(--transition-fast);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-color);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* ---- Modals ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    padding: 20px;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--background-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform var(--transition-fast);
}

.modal-overlay.open .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    background: var(--background-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* ---- Map Popup ---- */
.leaflet-popup-content-wrapper {
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
    padding: 0 !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    min-width: 260px;
}

.map-popup {
    padding: 16px;
}

.map-popup .popup-category {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 3px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    color: white;
}

.map-popup .popup-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.map-popup .popup-venue {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.map-popup .popup-datetime {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.map-popup .popup-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    padding: 8px 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.map-popup .popup-stat {
    text-align: center;
}

.map-popup .popup-stat .stat-num {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-color);
}

.map-popup .popup-stat .stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.map-popup .popup-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ---- Tabs ---- */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    min-height: 44px;
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ---- Auth Pages ---- */
.auth-container {
    display: none;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--background-secondary);
}

.auth-container.active {
    display: flex;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--background-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

.auth-card .auth-brand {
    text-align: center;
    margin-bottom: 32px;
}

.auth-card .auth-brand .brand-icon {
    width: 56px;
    height: 56px;
    background: var(--accent-color);
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 12px;
}

.auth-card .auth-brand h1 {
    font-size: 22px;
    font-weight: 700;
}

.auth-card .auth-brand p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.social-login {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--background-color);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    min-height: 44px;
    transition: all var(--transition-fast);
}

.btn-social:hover {
    background: var(--background-secondary);
    border-color: var(--text-muted);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    color: var(--text-muted);
    font-size: 13px;
}

.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-footer a {
    font-weight: 500;
}

/* ---- Toast Notifications ---- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    background: var(--background-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    min-width: 300px;
    max-width: 450px;
    animation: toastIn 300ms ease;
}

.toast.success { border-left: 4px solid #27AE60; }
.toast.error { border-left: 4px solid #EF4444; }
.toast.info { border-left: 4px solid var(--accent-color); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ---- Skeleton Loading ---- */
.skeleton {
    background: linear-gradient(90deg, var(--background-secondary) 25%, var(--border-light) 50%, var(--background-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---- Responsive: Mobile ---- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .topbar {
        left: 0;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .search-container input {
        min-width: 0;
    }

    .user-menu-trigger .user-name {
        display: none;
    }

    .main-content {
        padding: 16px;
    }

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

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

    .map-container {
        height: 350px;
    }

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

    /* Sidebar overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.open {
        display: block;
    }
}

@media (max-width: 480px) {
    .topbar-right .notification-btn {
        display: none;
    }

    .auth-card {
        padding: 24px;
    }

    .rsvp-buttons {
        flex-direction: column;
    }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ---- Utility classes ---- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
