/* ============================================
   MC3 CALENDAR — Design Token System
   3-tier: Primitives → Semantic → Component
   ============================================ */

/* ===== TIER 1 — PRIMITIVES (raw values) ===== */
:root {
    /* Navy palette */
    --navy-900: #0a1628;
    --navy-800: #0f1f3a;
    --navy-700: #142238;
    --navy-600: #1a2d4d;
    --navy-500: #1e3a5f;

    /* Frost palette */
    --frost-100: #e8f4f8;
    --frost-200: #a8c5d1;
    --frost-300: #6b8a9a;

    /* Accent palette */
    --cyan-400: #00b4d8;
    --cyan-600: #0077b6;
    --cyan-200: #90e0ef;

    /* Status palette */
    --green-400: #00d68f;
    --amber-400: #ffaa00;
    --red-400: #ff6b6b;

    /* Type badge palette */
    --purple-400: #9b59b6;
    --orange-400: #e67e22;
    --gray-400: #95a5a6;

    /* Typography */
    --font-display: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;

    /* Shadows (primitives) */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
}

/* ===== TIER 2 — SEMANTIC (overridable per site) ===== */
:root {
    --brand-hue: 210;

    /* Accent (semantic aliases to palette) */
    --accent-primary: var(--cyan-400);
    --accent-secondary: var(--cyan-600);
    --accent-tertiary: var(--cyan-200);

    /* Backgrounds */
    --color-bg-primary: var(--navy-900);
    --color-bg-secondary: var(--navy-800);
    --color-bg-surface: var(--navy-700);
    --color-bg-surface-hover: var(--navy-600);

    /* Text */
    --color-text-primary: var(--frost-100);
    --color-text-secondary: var(--frost-200);
    --color-text-muted: var(--frost-300);

    /* Status */
    --color-success: var(--green-400);
    --color-warning: var(--amber-400);
    --color-danger: var(--red-400);

    /* Border */
    --color-border: var(--navy-500);
    --color-border-glow: rgba(0, 180, 216, 0.3);

    /* Glow shadow */
    --shadow-glow: 0 0 30px rgba(0, 180, 216, 0.2);
}

/* ===== TIER 3 — COMPONENT (references to semantic) ===== */
:root {
    /* Card */
    --card-bg: var(--color-bg-surface);
    --card-bg-hover: var(--color-bg-surface-hover);
    --card-border: var(--color-border);
    --card-border-hover: var(--accent-secondary);

    /* Button */
    --button-bg: var(--accent-secondary);
    --button-bg-hover: var(--accent-primary);
    --button-text: #ffffff;

    /* Header */
    --header-bg: rgba(10, 22, 40, 0.95);
    --header-border: var(--color-border);

    /* Links */
    --link-color: var(--accent-primary);
    --link-color-hover: var(--accent-tertiary);

    /* Body gradients */
    --body-gradient-accent: rgba(0, 180, 216, 0.05);
    --hero-gradient-accent: rgba(0, 119, 182, 0.1);

    /* Tags */
    --tag-bg: rgba(0, 180, 216, 0.1);
    --tag-border: rgba(0, 180, 216, 0.2);
    --tag-bg-hover: rgba(0, 180, 216, 0.2);

    /* Type badges */
    --type-conference-bg: rgba(0, 180, 216, 0.2);
    --type-summit-bg: rgba(255, 170, 0, 0.2);
    --type-expo-bg: rgba(0, 214, 143, 0.2);
    --type-forum-bg: rgba(144, 224, 239, 0.2);
    --type-symposium-bg: rgba(255, 107, 107, 0.2);
    --type-training-bg: rgba(138, 43, 226, 0.2);
    --type-workshop-bg: rgba(230, 126, 34, 0.2);
    --type-meeting-bg: rgba(149, 165, 166, 0.2);

    /* CFP pulse */
    --cfp-pulse-color: rgba(0, 214, 143, 0.4);
    --cfp-pulse-end: rgba(0, 214, 143, 0);

    /* Favorites */
    --favorite-hover-bg: rgba(255, 107, 107, 0.1);
    --favorite-border: rgba(255, 107, 107, 0.4);
    --favorite-filter-border: rgba(255, 107, 107, 0.3);
    --favorite-glow: rgba(255, 107, 107, 0.3);
    --favorite-gradient-accent: rgba(255, 107, 107, 0.05);
    --favorite-active-end: #ff8787;

    /* Export */
    --export-empty-bg: rgba(255, 170, 0, 0.1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-display);
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
    line-height: 1.6;
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse at top, var(--body-gradient-accent) 0%, transparent 50%),
        linear-gradient(180deg, var(--color-bg-primary) 0%, var(--color-bg-secondary) 100%);
    background-attachment: fixed;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--link-color-hover);
}

/* ===== HEADER ===== */
.header {
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--header-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--color-text-primary);
}

.logo-icon {
    font-size: 1.5rem;
}

/* Hub link */
.hub-link {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.hub-link:hover {
    background: var(--accent-primary);
    color: var(--color-bg-primary);
}

/* Site badge */
.site-badge {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.site-badge--filled {
    background: var(--accent-primary);
    color: var(--color-bg-primary);
}

.site-badge--outline {
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-links a {
    color: var(--color-text-secondary);
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: var(--accent-primary);
}

/* Language Switcher */
.nav-right {
    display: flex;
    align-items: center;
    gap: 25px;
}

.lang-switcher {
    display: flex;
    gap: 8px;
}

.lang-link {
    font-size: 1.3rem;
    opacity: 0.5;
    transition: opacity 0.2s ease, transform 0.2s ease;
    text-decoration: none;
}

.lang-link:hover {
    opacity: 0.8;
    transform: scale(1.1);
}

.lang-link.active {
    opacity: 1;
}

/* ===== HERO ===== */
.hero {
    padding: 60px 20px;
    text-align: center;
    background: linear-gradient(135deg, var(--hero-gradient-accent) 0%, transparent 100%);
    border-bottom: 1px solid var(--color-border);
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 15px;
    background: linear-gradient(135deg, var(--color-text-primary) 0%, var(--accent-tertiary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--color-text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ===== CONTROLS ===== */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
    align-items: center;
    padding: 30px 0;
    border-bottom: 1px solid var(--color-border);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-btn {
    padding: 10px 18px;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    background: var(--card-bg);
    color: var(--color-text-secondary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.filter-btn.active {
    background: var(--accent-secondary);
    border-color: var(--accent-primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

.search-box input {
    padding: 12px 20px;
    width: 280px;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    background: var(--card-bg);
    color: var(--color-text-primary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

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

/* ===== STATS ===== */
.stats {
    display: flex;
    gap: 30px;
    padding: 20px 0;
    font-family: var(--font-mono);
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.stat-item strong {
    color: var(--accent-primary);
    font-size: 1.1rem;
}

/* ===== CONFERENCES GRID ===== */
.conferences-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 25px;
    padding: 30px 0;
}

/* ===== CONFERENCE CARD ===== */
.conference-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 25px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 15px;
    position: relative;
    overflow: hidden;
}

.conference-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-secondary), var(--accent-primary));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.conference-card:hover {
    background: var(--card-bg-hover);
    border-color: var(--card-border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.conference-card:hover::before {
    opacity: 1;
}

.conference-card.hidden {
    display: none;
}

/* Card Header */
.card-header {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.card-type {
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.type-conference { background: var(--type-conference-bg); color: var(--accent-primary); }
.type-summit { background: var(--type-summit-bg); color: var(--color-warning); }
.type-expo { background: var(--type-expo-bg); color: var(--color-success); }
.type-forum { background: var(--type-forum-bg); color: var(--accent-tertiary); }
.type-symposium { background: var(--type-symposium-bg); color: var(--color-danger); }
.type-training { background: var(--type-training-bg); color: var(--purple-400); }
.type-workshop { background: var(--type-workshop-bg); color: var(--orange-400); }
.type-meeting { background: var(--type-meeting-bg); color: var(--gray-400); }

.cyber-badge {
    font-size: 1rem;
    cursor: help;
}

.cfp-badge {
    padding: 3px 8px;
    background: var(--color-success);
    color: var(--color-bg-primary);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
}

.cfp-badge.pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--cfp-pulse-color); }
    50% { box-shadow: 0 0 0 8px var(--cfp-pulse-end); }
}

.online-badge,
.tentative-badge {
    font-size: 0.9rem;
    cursor: help;
}

/* Card Title */
.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-text-primary);
    line-height: 1.4;
}

/* Card Meta */
.card-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.meta-icon {
    font-size: 1rem;
    width: 24px;
    text-align: center;
}

/* Card Description */
.card-description {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    flex-grow: 1;
}

/* Card Tags */
.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    padding: 4px 10px;
    background: var(--tag-bg);
    border: 1px solid var(--tag-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-tertiary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tag:hover {
    background: var(--tag-bg-hover);
    border-color: var(--accent-primary);
}

/* Card Actions */
.card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--card-border);
}

.btn {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--button-bg);
    color: var(--button-text);
    border: none;
}

.btn-primary:hover {
    background: var(--button-bg-hover);
    color: var(--button-text);
    box-shadow: var(--shadow-glow);
}

.btn-cfp {
    background: transparent;
    color: var(--color-success);
    border: 1px solid var(--color-success);
}

.btn-cfp:hover {
    background: var(--color-success);
    color: var(--color-bg-primary);
}

/* ===== NO RESULTS ===== */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-muted);
}

.no-results p {
    font-size: 1.2rem;
}

/* ===== LEGEND ===== */
.legend {
    padding: 30px 20px;
    margin-top: 40px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--card-border);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.legend h4 {
    margin-bottom: 15px;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

/* ===== FOOTER ===== */
.footer {
    margin-top: 80px;
    background: var(--color-bg-secondary);
    border-top: 1px solid var(--color-border);
    padding: 60px 0 30px;
}

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

.footer-section h4 {
    color: var(--color-text-primary);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.footer-section p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    line-height: 1.7;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section ul a {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.footer-section ul a:hover {
    color: var(--accent-primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.credits {
    margin-top: 10px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .filters {
        justify-content: center;
    }

    .search-box input {
        width: 100%;
    }

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

    .stats {
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav {
        flex-direction: column;
        gap: 15px;
    }

    .nav-links {
        gap: 15px;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.conference-card {
    animation: fadeIn 0.5s ease forwards;
}

.conference-card:nth-child(1) { animation-delay: 0.05s; }
.conference-card:nth-child(2) { animation-delay: 0.1s; }
.conference-card:nth-child(3) { animation-delay: 0.15s; }
.conference-card:nth-child(4) { animation-delay: 0.2s; }
.conference-card:nth-child(5) { animation-delay: 0.25s; }
.conference-card:nth-child(6) { animation-delay: 0.3s; }

/* ===== FAVORITES ===== */
.favorite-btn {
    margin-left: auto;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.favorite-btn:hover {
    background: var(--favorite-hover-bg);
    transform: scale(1.1);
}

.favorite-btn .favorite-icon::before {
    content: '\2661';
    font-size: 1.3rem;
    color: var(--color-text-muted);
    transition: all 0.2s ease;
}

.favorite-btn:hover .favorite-icon::before {
    color: var(--color-danger);
}

.favorite-btn.active .favorite-icon::before {
    content: '\2665';
    color: var(--color-danger);
}

.favorite-btn.active:hover .favorite-icon::before {
    transform: scale(1.1);
}

/* Favorite card styling */
.conference-card.is-favorite {
    border-color: var(--favorite-border);
}

.conference-card.is-favorite::before {
    background: linear-gradient(90deg, var(--color-danger), var(--color-warning));
    opacity: 1;
}

/* Favorites filter button */
.filter-btn[data-filter="favorites"] {
    border-color: var(--favorite-filter-border);
}

.filter-btn[data-filter="favorites"]:hover {
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.filter-btn[data-filter="favorites"].active {
    background: linear-gradient(135deg, var(--color-danger), var(--favorite-active-end));
    border-color: var(--color-danger);
    color: white;
    box-shadow: 0 0 20px var(--favorite-glow);
}

/* ===== FAVORITES PANEL ===== */
.favorites-panel {
    margin: 20px 0 30px;
    padding: 25px;
    background: linear-gradient(135deg, var(--card-bg) 0%, var(--favorite-gradient-accent) 100%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--card-border);
    border-left: 4px solid var(--color-danger);
}

.favorites-info {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 30px;
    align-items: start;
}

.favorites-info-content h4 {
    color: var(--color-text-primary);
    font-size: 1.1rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.favorites-info-content h4::before {
    content: '\2665';
    color: var(--color-danger);
}

.favorites-info-content p {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 8px;
}

.favorites-info-content .privacy-note {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

.favorites-export {
    text-align: center;
    min-width: 200px;
}

.favorites-export h4 {
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.favorites-stat strong {
    color: var(--color-danger) !important;
}

@media (max-width: 768px) {
    .favorites-info {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .favorites-export {
        border-top: 1px solid var(--card-border);
        padding-top: 20px;
    }
}

.export-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-export {
    padding: 12px 24px;
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-export:hover {
    background: var(--accent-secondary);
    border-color: var(--accent-primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

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

#export-txt::before {
    content: '\1F4C4';
}

#export-pdf::before {
    content: '\1F4D1';
}

.export-empty-msg {
    color: var(--color-warning);
    font-size: 0.85rem;
    margin-top: 15px;
    padding: 10px;
    background: var(--export-empty-bg);
    border-radius: var(--radius-sm);
}
