@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* Modern Palette (Slate & Indigo) */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --primary: #4f46e5; /* Indigo 600 */
    --primary-hover: #4338ca;
    
    --border-color: #e2e8f0;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Generic Colors Palette */
    --c-red: #ef4444;       /* Червоний */
    --c-blue: #3b82f6;      /* Синій */
    --c-green: #10b981;     /* Зелений */
    --c-orange: #f97316;    /* Помаранчевий */
    --c-purple: #8b5cf6;    /* Фіолетовий */
    --c-cyan: #06b6d4;      /* Блакитний */
    --c-pink: #ec4899;      /* Рожевий */
    --c-yellow: #eab308;    /* Жовтий */
    --c-gray: #64748b;      /* Сірий */
    --c-indigo: #6366f1;    /* Індиго */
    --c-teal: #14b8a6;      /* Бірюзовий */
    --c-lime: #84cc16;      /* Лайм */
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* --- HEADER & TYPOGRAPHY --- */
h1 {
    text-align: center;
    font-weight: 800;
    color: var(--text-primary);
    font-size: 2.25rem;
    margin-bottom: 10px;
    letter-spacing: -0.025em;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

/* --- FILTERS BAR --- */
.filters {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
    margin-bottom: 50px;
	position: sticky;
    top: 20px;
    z-index: 100;
}

.filter-group {
    flex: 1;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

select {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

select:hover, select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.reset-link {
    padding: 30px 20px;
    color: var(--text-secondary);
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: 0.2s;
    background: var(--bg-body);
}
.reset-link:hover { background: #e2e8f0; color: var(--text-primary); }

/* --- EVENT GRID --- */
.month-section { margin-bottom: 60px; }
.month-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.month-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

/* --- MODERN CARD DESIGN --- */
.event-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.event-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: #cbd5e1;
}

/* Accent Top Bar on Card */
.event-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--c-default); /* Default fallback */
}
/* --- UNIVERSAL COLOR CLASSES --- */

/* Accent Top Bar */
.brand-red::before { background: var(--c-red); }
.brand-blue::before { background: var(--c-blue); }
.brand-green::before { background: var(--c-green); }
.brand-orange::before { background: var(--c-orange); }
.brand-purple::before { background: var(--c-purple); }
.brand-cyan::before { background: var(--c-cyan); }
.brand-pink::before { background: var(--c-pink); }
.brand-yellow::before { background: var(--c-yellow); }
.brand-gray::before { background: var(--c-gray); }
.brand-indigo::before { background: var(--c-indigo); }
.brand-teal::before { background: var(--c-teal); }
.brand-lime::before { background: var(--c-lime); }

/* Text Colors */
.text-red { color: var(--c-red); }
.text-blue { color: var(--c-blue); }
.text-green { color: var(--c-green); }
.text-orange { color: var(--c-orange); }
.text-purple { color: var(--c-purple); }
.text-cyan { color: var(--c-cyan); }
.text-pink { color: var(--c-pink); }
.text-yellow { color: var(--c-yellow); }
.text-gray { color: var(--c-gray); }
.text-indigo { color: var(--c-indigo); }
.text-teal { color: var(--c-teal); }
.text-lime { color: var(--c-lime); }

/* Card Content */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.event-date {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.event-type {
    font-size: 0.7rem;
    padding: 6px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.type-internal { background-color: #eff6ff; color: #1e40af; }
.type-external { background-color: #fff7ed; color: #9a3412; }

.brand-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
}
/* Dynamic Text Color based on brand */
.text-hikvision { color: var(--c-hikvision); }
.text-dahua { color: var(--c-dahua); }
.text-ruijie { color: var(--c-ruijie); }
.text-dnake { color: var(--c-dnake); }
.text-rau { color: var(--c-rau); }

.event-format {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 20px;
    display: inline-block;
}

.event-location {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px dashed var(--border-color);
}

.loc-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 6px;
    font-weight: 500;
}
.loc-icon { opacity: 0.6; }

/* --- ADMIN STYLES (Overrides) --- */
/* Simple clean styles for admin tables */
table { width: 100%; border-spacing: 0; }
th { background: #f8fafc; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; color: var(--text-secondary); padding: 16px; border-bottom: 1px solid var(--border-color); }
td { padding: 16px; border-bottom: 1px solid var(--border-color); font-size: 0.95rem; }
tr:last-child td { border-bottom: none; }

/* Badges for Money */
.money { font-family: 'Inter', monospace; font-weight: 600; font-size: 0.95rem; }
.over-budget { color: #dc2626; background: #fef2f2; padding: 2px 6px; border-radius: 4px; }

/* Stats Widget in Admin */
.stat-box {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}
.stat-box::after {
    content: '';
    position: absolute;
    top: -50%; right: -50%;
    width: 200px; height: 200px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}
/* --- BUTTONS FIX --- */

/* 1. Базовий стиль для всіх кнопок (за замовчуванням - сірі) */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    text-decoration: none;
    
    /* Дефолтний вигляд (якщо немає класу primary/danger) */
    background-color: #f1f5f9; /* Світло-сірий фон */
    color: #334155;           /* Темно-сірий текст */
}

button:hover, .btn:hover {
    background-color: #e2e8f0;
    transform: translateY(-1px);
}

/* 2. Основна кнопка (СИНЯ) - "Додати", "Зберегти" */
.btn-primary {
    background-color: #4f46e5 !important; /* Indigo */
    color: #ffffff !important;             /* Білий текст */
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background-color: #4338ca !important; /* Darker Indigo */
    box-shadow: 0 6px 10px -1px rgba(79, 70, 229, 0.3);
}

/* 3. Кнопка небезпеки (ЧЕРВОНА) - "Видалити" */
.btn-danger {
    background-color: #ef4444 !important; /* Red */
    color: #ffffff !important;            /* Білий текст */
}

.btn-danger:hover {
    background-color: #dc2626 !important;
}

/* 4. Кнопка "Скасувати" або маленькі кнопки редагування */
.btn-ghost, .btn-sm {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    color: #64748b;
}

.btn-ghost:hover, .btn-sm:hover {
    background-color: #f8fafc;
    color: #0f172a;
    border-color: #94a3b8;
}

/* --- ROLE BADGES --- */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-right: 8px; /* Відступ від інших бейджів */
}

/* Кольори для ролей */
.role-visitor {
    background-color: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
}

.role-participant {
    background-color: #eff6ff; /* Світло-синій */
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.role-speaker {
    background-color: #f5f3ff; /* Світло-фіолетовий */
    color: #7c3aed;
    border: 1px solid #ddd6fe;
}

.role-organizer {
    background-color: #fffbeb; /* Світло-жовтий/золотий */
    color: #b45309;
    border: 1px solid #fde68a;
}

/* --- UNIFIED BADGES (Types & Roles) --- */

/* Спільні стилі для ВСІХ бейджів */
.event-type, .role-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
    border: none;
    margin: 0; /* 🔥 ВАЖЛИВО: Прибираємо всі зовнішні відступи */
}

/* --- КОЛЬОРИ ДЛЯ ТИПІВ --- */
.type-internal { background-color: #dbeafe; color: #1e40af; }
.type-external { background-color: #ffedd5; color: #9a3412; }

/* --- КОЛЬОРИ ДЛЯ РОЛЕЙ --- */
.role-visitor { background-color: #f1f5f9; color: #475569; }
.role-participant { background-color: #e0e7ff; color: #3730a3; }
.role-speaker { background-color: #dcfce7; color: #166534; }
.role-organizer { background-color: #fef9c3; color: #854d0e; }

/* --- ARCHIVE DETAILS --- */
.archive-details summary {
    cursor: pointer;
    padding: 15px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 30px;
    user-select: none;
    transition: 0.2s;
    list-style: none; /* remove default marker */
}
.archive-details summary::-webkit-details-marker {
    display: none; /* Safari */
}
.archive-details summary:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}
.archive-content {
    padding-top: 20px;
    border-top: 1px dashed var(--border-color);
    margin-top: -10px;
    margin-bottom: 40px;
}