/* ========= Regional Theme - Castilla-La Mancha ========= */
:root{
    /* Neutrals - Warm earth tones */
    --bg: #f8f6f2;          /* warm off-white */
    --surface: #ffffff;     /* pure white */
    --line: #e8e0d8;        /* warm gray borders */
    --text: #2d1b0e;        /* deep brown text */
    --muted: #8b7355;       /* warm muted brown */
  
      /* Regional accents - Castilla-La Mancha colors */
  --primary: #8b4513;     /* saddle brown - tierra manchega */
  --primary-ink: #5d2e0d; /* darker brown for text */
  --accent: #6b8e23;      /* olive drab - olivares */
  --accent-ink: #4a5d1a;
  --regional-blue: #1e3a8a; /* azul de Castilla-La Mancha */
  --regional-blue-light: #3b82f6; /* azul más claro para hover */
  
    /* Effects */
    --radius: 14px;
    --radius-pill: 999px;
    --shadow-sm: 0 4px 12px rgba(45,27,14,.08);
    --shadow-md: 0 8px 24px rgba(45,27,14,.12);
    --ring: 0 0 0 3px rgba(139,69,19,.25);
  }

/* Dark theme variables - Regional night colors */
.dark-theme {
    --bg: #1a0f05;          /* deep brown night */
    --surface: #2d1b0e;     /* dark brown surface */
    --line: #4a3c2e;        /* warm dark borders */
    --text: #f8f6f2;        /* warm light text */
    --muted: #a89b8a;       /* warm muted */
    --primary-ink: #e8d5c4; /* warm light brown */
    --accent-ink: #d4e8c4;  /* warm light olive */
    --shadow-sm: 0 4px 12px rgba(0,0,0,.4);
    --shadow-md: 0 8px 24px rgba(0,0,0,.5);
  }
  
  *{box-sizing:border-box}
  html,body{height:100%}
  
  /* Prevent horizontal scroll globally */
  html{
    overflow-x: hidden;
  }
  body{
    margin:0;
    background:
      radial-gradient(1200px 600px at 10% -10%, rgba(139,69,19,.06), transparent 50%),
      radial-gradient(900px 500px at 110% 10%, rgba(107,142,35,.06), transparent 50%),
      var(--bg);
    color:var(--text);
    font-family: Inter, system-ui, Segoe UI, Roboto, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color .3s ease, color .3s ease;
    position: relative;
  }

  body::before{
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
      radial-gradient(circle at 20% 80%, rgba(139,69,19,.02) 0%, transparent 50%),
      radial-gradient(circle at 80% 20%, rgba(107,142,35,.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
  }

  .dark-theme body{
    background:
      radial-gradient(1200px 600px at 10% -10%, rgba(139,69,19,.12), transparent 50%),
      radial-gradient(900px 500px at 110% 10%, rgba(107,142,35,.12), transparent 50%),
      var(--bg);
  }
  
  /* Links */
  a{color:var(--primary); text-decoration:none}
  a:hover{text-decoration:underline}
  
  /* Layout */
  .wrap{max-width:1060px;margin:0 auto;padding:0 16px}
  
  /* ===== Header / Hero ===== */
  .app-header{
    position:sticky; 
    top:0; 
    z-index:10;
    background: rgba(255,255,255,.98);
    border-bottom:1px solid var(--line);
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
  }
  
  .dark-theme .app-header{
    background: rgba(45,27,14,.98);
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
  }
  
  .header-banner{
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  
  .banner-content{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }
  
  .banner-left{
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
  }
  
  .banner-title{
    flex: 1;
  }
  
  h1{
    margin:0; 
    font-size:clamp(20px,4vw,32px); 
    font-weight:700; 
    letter-spacing:-.01em;
    line-height: 1.2;
  }
  
  .subtitle{
    color:var(--muted); 
    margin:2px 0 0;
    font-size: 13px;
  }
  
  .banner-controls{
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .mobile-menu-toggle{
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all .15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .mobile-menu-toggle:hover{
    border-color: var(--regional-blue);
    box-shadow: var(--shadow-sm);
  }
  
  .menu-icon{
    font-size: 18px;
    color: var(--text);
    transition: color 0.3s ease;
  }
  
  .mobile-menu-toggle:hover .menu-icon{
    color: var(--regional-blue);
  }
  
  .header-filters{
    padding: 12px 0;
    background: rgba(255,255,255,.95);
    border-bottom: 1px solid var(--line);
  }
  
  .dark-theme .header-filters{
    background: rgba(45,27,14,.95);
  }
  
  /* Mobile behavior */
  .mobile-menu-toggle{
    display: none;
  }
  
  .mobile .mobile-menu-toggle{
    display: block;
  }
  
  .mobile .header-filters{
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    border-bottom: none;
  }
  
  .mobile .header-filters.expanded{
    padding: 12px 0;
    max-height: 500px;
    border-bottom: 1px solid var(--line);
  }
  
  .mobile .filters-content{
    gap: 16px;
  }
  
  .mobile .search-section{
    flex-direction: column;
    width: 100%;
  }
  
  .mobile .filters-section{
    flex-direction: column;
    width: 100%;
  }
  
  .mobile .filter-controls{
    margin: 0;
  }
  
  .mobile .filter-row{
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  
  .mobile .filter-group{
    min-width: auto;
    width: 100%;
  }
  
  .mobile .filter-select{
    padding: 12px 16px;
    font-size: 16px;
    width: 100%;
    border-radius: 8px;
  }
  
  .mobile .filter-btn{
    padding: 12px 16px;
    font-size: 16px;
    width: 100%;
    border-radius: 8px;
    justify-content: center;
  }
  
  .mobile .selected-tags{
    margin-top: 12px;
    gap: 8px;
  }
  
  .mobile .selected-tag{
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 6px;
  }
  
  .mobile .selected-tags-label{
    font-size: 13px;
    margin-bottom: 4px;
  }
  
  .filters-content{
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  
  .search-section{
    display: flex;
    gap: 8px;
  }
  
  .filters-section{
    display: flex;
    gap: 8px;
  }
  
  
    
      /* Mobile responsive adjustments */
  .mobile .header-banner{
    padding: 8px 0;
  }
  
  .mobile .banner-content{
    gap: 8px;
  }
  
  .mobile .banner-left{
    flex: 1;
    min-width: 0;
  }
  
  .mobile .banner-title{
    min-width: 0;
  }
  
  .mobile h1{
    font-size: 18px;
    line-height: 1.2;
  }
  
  .mobile .subtitle{
    font-size: 11px;
    margin: 1px 0 0;
  }
  
  .mobile .flag{
    height: 40px;
    margin-right: 8px;
  }
  input[type="search"]{
    flex:1; 
    min-width:200px;
    background: var(--surface);
    border:1px solid var(--line);
    color: var(--text);
    padding:8px 12px;
    border-radius:8px;
    outline:none;
    box-shadow: var(--shadow-sm);
    transition: border-color .15s ease, box-shadow .15s ease, transform .06s ease;
    font-size: 14px;
  }
  input[type="search"]:focus{ border-color: var(--primary); box-shadow: var(--ring); }
  input[type="search"]:active{ transform: scale(.998); }
  
  .mobile input[type="search"]{
    min-width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border-radius: 8px;
    width: 100%;
  }

  /* Tag filters */
  .tag-filters{
    display:flex; 
    gap:6px; 
    flex-wrap:wrap; 
    margin-top:6px;
    overflow: visible;
  }
  .tag-filter{
    background: var(--surface);
    border:1px solid var(--line);
    color: var(--text);
    padding:4px 8px;
    border-radius: var(--radius-pill);
    font-size:12px; 
    font-weight:600;
    cursor:pointer;
    box-shadow: var(--shadow-sm);
    transition: all .15s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
  }
  .tag-filter:hover{
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
  }
  .tag-filter::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
  }
  .tag-filter:hover::before {
    left: 100%;
  }
  .tag-filter.active{
    background: linear-gradient(180deg, rgba(34,197,94,.12), rgba(34,197,94,.06));
    border-color: rgba(34,197,94,.35);
    color: var(--accent-ink);
  }

  .dark-theme .tag-filter.active{
    background: linear-gradient(180deg, rgba(34,197,94,.25), rgba(34,197,94,.15));
    border-color: rgba(34,197,94,.5);
    color: #dcfce7;
  }

  /* Tag icons */
  .tag-icon{
    margin-right: 4px;
    font-size: 14px;
    display: inline-block;
    transition: transform .2s ease;
  }
  
  .tag:hover .tag-icon,
  .tag-filter:hover .tag-icon {
    transform: scale(1.2) rotate(5deg);
  }

  /* Theme toggle */
  .theme-toggle{
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    padding: 8px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all .12s ease;
  }
  
  @media (max-width: 420px){
    .theme-toggle{
      padding: 8px;
      font-size: 16px;
      align-self: flex-end;
    }
  }
  .theme-toggle:hover{
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
  }


  
  /* Filter controls */
  .filter-controls{
    margin: 8px 0 6px;
  }
  
  .filter-row{
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
  }
  
  .filter-group{
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 160px;
  }
  
  .filter-label{
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  
  .mobile .filter-label{
    font-size: 14px;
    margin-bottom: 4px;
  }
  
  .filter-select{
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    transition: all .15s ease;
  }
  
  .filter-select:focus{
    outline: none;
    border-color: var(--regional-blue);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.25);
  }
  
  .filter-btn{
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all .15s ease;
    white-space: nowrap;
  }
  
  .filter-btn:hover{
    border-color: var(--regional-blue);
    box-shadow: var(--shadow-sm);
  }
  
  .filter-btn.active{
    background: var(--regional-blue);
    border-color: var(--regional-blue);
    color: white;
  }
  
  .selected-tags{
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
    align-items: center;
  }
  
  .mobile .selected-tags{
    flex-direction: column;
    align-items: stretch;
  }
  
  .selected-tags-label{
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
  }
  
  .selected-tag{
    background: var(--regional-blue);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
  }
  
  .selected-tag:hover{
    background: var(--regional-blue-light);
    transform: scale(1.05);
  }
  
  /* Day pills (legacy) */
  .days{display:flex; gap:8px; flex-wrap:wrap; overflow:visible; padding:6px 2px}
  .pill{
    border:1px solid var(--line);
    background:
      linear-gradient(180deg, #ffffff, #f7f9fc);
    color:#1f2937;
    padding:8px 12px;
    border-radius:var(--radius-pill);
    white-space:nowrap;
    cursor:pointer; font-weight:600;
    box-shadow: var(--shadow-sm);
    transition: all .15s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
  }
  .pill:hover{ 
    transform: translateY(-2px) scale(1.05); 
    box-shadow: var(--shadow-md); 
  }
  .pill.active{
    background:
      linear-gradient(180deg, rgba(59,130,246,.12), rgba(59,130,246,.06));
    border-color: rgba(59,130,246,.35);
    color: var(--primary-ink);
  }

  .pill.today{
    background: linear-gradient(180deg, rgba(34,197,94,.12), rgba(34,197,94,.06));
    border-color: rgba(34,197,94,.35);
    color: var(--accent-ink);
    font-weight: 700;
  }

  .pill.today.active{
    background: linear-gradient(180deg, rgba(34,197,94,.2), rgba(34,197,94,.1));
    border-color: rgba(34,197,94,.5);
    color: var(--accent-ink);
  }

  .dark-theme .pill.today{
    background: linear-gradient(180deg, rgba(34,197,94,.2), rgba(34,197,94,.1));
    border-color: rgba(34,197,94,.4);
  }

  .dark-theme .pill.today.active{
    background: linear-gradient(180deg, rgba(34,197,94,.3), rgba(34,197,94,.15));
    border-color: rgba(34,197,94,.6);
  }

  .pill.today.disabled{
    opacity: 0.6;
    cursor: not-allowed;
    background: linear-gradient(180deg, rgba(156,163,175,.12), rgba(156,163,175,.06));
    border-color: rgba(156,163,175,.35);
    color: var(--muted);
  }

  .pill.today.disabled:hover{
    transform: none;
    box-shadow: var(--shadow-sm);
  }
  
  /* ===== Main ===== */
  main{padding:16px 0 80px}
  
  @media (max-width: 420px){
    main{
      padding: 12px 0 60px;
    }
  }
  
  /* View controls */
  .view-controls{
    margin: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
  }
  
  .view-toggle{
    display: flex;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 4px;
    box-shadow: var(--shadow-sm);
  }
  
  .view-btn{
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: calc(var(--radius) - 4px);
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  
  .view-btn.active{
    background: var(--regional-blue);
    color: white;
    box-shadow: var(--shadow-sm);
  }
  
  .view-icon{
    font-size: 16px;
  }

  /* Stats toggle */
  .stats-toggle{
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 8px 16px;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .stats-toggle:hover{
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
  }

  .stats-toggle.active{
    background: var(--regional-blue);
    color: white;
    border-color: var(--regional-blue);
  }
  
  .section{margin:22px 0}
  .section h2{
    font-size:18px; margin:0 0 12px;
    color: var(--primary-ink);
    letter-spacing:.2px;
  }

  /* Statistics section */
  .stats-section{
    margin: 30px 0;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
  }

  .stats-section h2{
    font-size: 20px;
    margin: 0 0 20px 0;
    text-align: center;
    color: var(--primary-ink);
  }

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

  .stats-card{
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(139,69,19,.04), rgba(107,142,35,.04));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: all .15s ease;
  }

  .stats-card:hover{
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
  }

  .stats-icon{
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--regional-blue);
    color: white;
    border-radius: 50%;
  }

  .stats-content{
    flex: 1;
  }

  .stats-value{
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
  }

  .stats-title{
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-ink);
    margin-top: 4px;
  }

  .stats-subtitle{
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
  }

  .top-tags h3{
    font-size: 16px;
    margin: 0 0 12px 0;
    color: var(--primary-ink);
  }

  .tags-list{
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .tag-stat{
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  .tag-rank{
    font-weight: 700;
    color: var(--primary);
    font-size: 14px;
    min-width: 30px;
  }

  .tag-name{
    flex: 1;
    font-weight: 600;
    color: var(--text);
  }

  .tag-count{
    font-size: 12px;
    color: var(--muted);
    background: var(--bg);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
  }

  /* Progress bar */
  .progress-container{
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
  }

  .progress-header{
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
  }

  .progress-icon{
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    border-radius: 50%;
  }

  .progress-info{
    flex: 1;
  }

  .progress-title{
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
  }

  .progress-status{
    font-size: 14px;
    color: var(--muted);
    text-transform: capitalize;
  }

  .progress-percentage{
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
  }

  .progress-bar{
    width: 100%;
    height: 12px;
    background: var(--bg);
    border-radius: var(--radius-pill);
    overflow: hidden;
    margin-bottom: 12px;
  }

  .progress-fill{
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--regional-blue));
    border-radius: var(--radius-pill);
    transition: width 0.8s ease-out;
    position: relative;
  }

  .progress-fill::after{
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
  }

  @keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
  }

  .progress-details{
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--muted);
  }

  .progress-remaining{
    color: var(--primary);
    font-weight: 600;
  }

  /* Card top layout */
  .card-top{
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0;
  }
  
  .card-top-left{
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
  }
  
  /* Status badges */
  .status-badge{
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    border-radius: var(--radius-pill);
    border: 1px solid;
    font-size: 11px;
    font-weight: 600;
  }

  .status-icon{
    font-size: 12px;
  }

  .status-text{
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  /* Timeline controls */
  .timeline-controls{
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .timeline-controls .status-badge{
    position: static;
    font-size: 10px;
  }

  .timeline-controls .status-icon{
    font-size: 11px;
  }

  /* Countdown timer */
  .countdown-timer{
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: linear-gradient(135deg, rgba(245,158,11,0.1), rgba(245,158,11,0.05));
    border: 1px solid rgba(245,158,11,0.3);
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 700;
    color: #f59e0b;
    margin: 8px 0;
    animation: pulse 2s infinite;
  }

  .countdown-icon{
    font-size: 14px;
  }

  .countdown-text{
    letter-spacing: 0.5px;
  }

  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
  }

  /* Timeline countdown positioning */
  .timeline-card .countdown-timer{
    position: absolute;
    top: 12px;
    right: 12px;
    margin: 0;
    font-size: 11px;
    padding: 4px 8px;
  }

  .timeline-card .countdown-icon{
    font-size: 12px;
  }

  /* Action buttons */
  .card-actions,
  .timeline-actions{
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .action-btn{
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text);
  }

  .action-btn:hover{
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
  }

  .action-btn:active{
    transform: translateY(0);
  }

  .action-icon{
    font-size: 12px;
  }

  .action-text{
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .calendar-btn:hover{
    background: rgba(139,69,19,.05);
    border-color: var(--primary);
  }

  .share-btn:hover{
    background: rgba(37, 211, 102, 0.1);
    border-color: #25d366;
    color: #25d366;
  }
  
  /* Grid */
  .grid{
    display:grid; gap:14px;
    grid-template-columns:repeat(auto-fill, minmax(280px, 1fr));
  }

  /* Smart grid for single events */
  .grid.single-event{
    grid-template-columns: minmax(280px, 400px);
    justify-content: center;
  }

  .grid.two-events{
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    max-width: 700px;
    margin: 0 auto;
  }

  .grid.three-events{
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    max-width: 900px;
    margin: 0 auto;
  }

  /* Special styling for sections with few events */
  .section.few-events h2{
    text-align: center;
    font-size: 20px;
    margin-bottom: 16px;
  }

  /* Timeline */
  .timeline{
    position: relative;
    padding-left: 30px;
  }
  
  .timeline::before{
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--line);
  }
  
  .timeline-section{
    margin: 30px 0;
  }
  
  .timeline-day{
    font-size: 20px;
    margin: 0 0 20px 0;
    color: var(--primary-ink);
    font-weight: 700;
    position: relative;
    padding-left: 20px;
  }
  
  .timeline-day::before{
    content: '';
    position: absolute;
    left: -15px;
    top: 50%;
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    transform: translateY(-50%);
    box-shadow: 0 0 0 4px var(--surface);
  }
  
  .timeline-events{
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  
  .timeline-event{
    position: relative;
    animation: cardEntrance 0.6s ease-out forwards;
    opacity: 0;
    transform: translateX(20px);
  }
  
  .timeline-marker{
    position: absolute;
    left: -30px;
    top: 20px;
    width: 20px;
    height: 20px;
  }
  
  .timeline-dot{
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    position: absolute;
    left: 4px;
    top: 4px;
    box-shadow: 0 0 0 3px var(--surface);
  }
  
  .timeline-line{
    position: absolute;
    left: 9px;
    top: 16px;
    width: 2px;
    height: calc(100% + 20px);
    background: var(--line);
  }
  
  .timeline-card{
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: all .15s ease;
  }
  
  .timeline-card:hover{
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
  }
  
  .timeline-time{
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
    padding: 4px 8px;
    border-radius: var(--radius-pill);
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }
  
  /* Timeline day event styling */
  .timeline-time.day-time{
    color: var(--primary-ink);
    background: linear-gradient(135deg, rgba(139,69,19,.1), rgba(107,142,35,.1));
    border: 1px solid rgba(139,69,19,.2);
  }
  
  .dark-theme .timeline-time.day-time{
    color: #e8d5c4;
    background: linear-gradient(135deg, rgba(139,69,19,.2), rgba(107,142,35,.2));
    border-color: rgba(139,69,19,.3);
  }
  
  /* Timeline night event styling */
  .timeline-time.night-time{
    color: #1e3a8a !important;
    background: linear-gradient(135deg, rgba(30,58,138,.1), rgba(59,130,246,.1));
    border: 1px solid rgba(30,58,138,.2);
  }
  
  .dark-theme .timeline-time.night-time{
    color: #93c5fd !important;
    background: linear-gradient(135deg, rgba(30,58,138,.2), rgba(59,130,246,.2));
    border-color: rgba(59,130,246,.3);
  }
  
  .timeline-header{
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
  }
  
  .timeline-title{
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    flex: 1;
  }
  
  .timeline-loc,
  .timeline-desc{
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
  }
  
  .timeline-tags{
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 12px 0;
  }
  
  .timeline-btn{
    margin-top: 12px;
    padding: 8px 16px;
    font-size: 14px;
  }
  
  /* Cards */
  .card{
    position:relative;
    background: var(--surface);
    border:1px solid var(--line);
    border-radius: var(--radius);
    padding:12px 12px 4px 12px; 
    min-height:120px;
    box-shadow: var(--shadow-sm);
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
    animation: cardEntrance 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

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

  @keyframes cardEntrance {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  .card::after{
    content:"";
    position:absolute; inset:auto -40px -40px auto;
    width:140px; height:140px; border-radius:50%;
    background: radial-gradient(closest-side, rgba(59,130,246,.10), transparent);
    pointer-events:none;
  }
  .card:hover{ 
    transform: translateY(-3px) scale(1.02); 
    box-shadow: var(--shadow-md); 
    border-color:#dae1ea; 
  }
  

  
  .time{
    font-weight: 800;
    letter-spacing: .3px;
    padding: 3px 6px;
    border-radius: var(--radius-pill);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 13px;
    white-space: nowrap;
  }
  
  /* Day event styling */
  .day-time{
    color: var(--primary-ink);
    background: linear-gradient(135deg, rgba(139,69,19,.1), rgba(107,142,35,.1));
    border: 1px solid rgba(139,69,19,.2);
  }
  
  .dark-theme .day-time{
    color: #e8d5c4;
    background: linear-gradient(135deg, rgba(139,69,19,.2), rgba(107,142,35,.2));
    border-color: rgba(139,69,19,.3);
  }
  
  /* Night event styling */
  .night-time{
    color: #1e3a8a !important;
    background: linear-gradient(135deg, rgba(30,58,138,.1), rgba(59,130,246,.1));
    border: 1px solid rgba(30,58,138,.2);
  }
  
  .dark-theme .night-time{
    color: #93c5fd !important;
    background: linear-gradient(135deg, rgba(30,58,138,.2), rgba(59,130,246,.2));
    border-color: rgba(59,130,246,.3);
  }
  
  .night-icon{
    font-size: 12px;
    animation: moonGlow 2s ease-in-out infinite alternate;
  }
  
  @keyframes moonGlow {
    0% { opacity: 0.7; }
    100% { opacity: 1; }
  }
  .title{font-weight:700; line-height:1.25; margin-bottom:8px; flex: 1}
  .loc{
    color: var(--muted);
    font-size: 13px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
  }
  

  

  
  .card-footer{
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
  }

  .tags{
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
  }

  .tag{
    font-size: 11px;
    color: var(--accent-ink);
    background: rgba(107,142,35,.08);
    border: 1px solid rgba(107,142,35,.2);
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    font-weight: 500;
    transition: all .15s ease;
  }

  .tag:hover{
    background: rgba(107,142,35,.12);
    border-color: rgba(107,142,35,.3);
  }

  .dark-theme .tag{
    background: rgba(107,142,35,.15);
    border-color: rgba(107,142,35,.3);
    color: #d4e8c4;
  }

  .dark-theme .tag:hover{
    background: rgba(107,142,35,.2);
    border-color: rgba(107,142,35,.4);
  }
  
  /* Buttons */
  button{
    background: linear-gradient(180deg, #8b4513, #6b3410);
    color: #ffffff;
    border:0; border-radius:10px;
    padding:9px 12px; font-weight:800; cursor:pointer;
    box-shadow: 0 6px 18px rgba(139,69,19,.25);
    transition: all .15s cubic-bezier(0.4, 0, 0.2, 1);
  }
  button:hover{ 
    filter:saturate(1.1) brightness(1.05);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139,69,19,.35);
  }
  button:active{ transform: translateY(0px) }
  button:focus-visible{ outline:none; box-shadow: var(--ring) }
  
  /* Favorite button */
  .fav-btn{
    border:1px solid var(--line);
    background: linear-gradient(180deg, #fff, #f6f9fc);
    border-radius: var(--radius-pill);
    padding:6px 8px; cursor:pointer;
    color:#f59e0b; /* amber-500 */
    box-shadow: var(--shadow-sm);
    transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 16px;
    z-index: 10;
  }

  /* Adjust card padding to accommodate status badge and countdown */
  .card{
    padding-top: 40px;
    padding-bottom: 50px;
  }
  .fav-btn:hover{
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
  }
  .fav-btn[aria-pressed="true"]{
    background: linear-gradient(180deg, var(--regional-blue-light), var(--regional-blue));
    border-color: var(--regional-blue);
    color: white;
    animation: heartBeat 0.6s ease-in-out;
  }
  
  @keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
  }
  
  /* Empty state & footer */
  .empty{
    color:var(--muted); 
    padding:22px 0;
    text-align: center;
    animation: fadeInUp 0.6s ease-out;
  }
  
  @keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  footer{
    color:var(--muted); 
    text-align:center; 
    margin:26px 0;
    position: relative;
  }

  .footer-decoration{
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
    opacity: 0.6;
  }

  .footer-decoration span{
    font-size: 18px;
    animation: float 3s ease-in-out infinite;
  }

  .footer-decoration span:nth-child(2){
    animation-delay: 1s;
  }

  .footer-decoration span:nth-child(3){
    animation-delay: 2s;
  }

  @keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
  }
  
  /* Reduced motion */
  @media (prefers-reduced-motion: reduce){
    *{transition:none !important}
  }
  
  /* Small screens tweaks */
  @media (max-width: 420px){
    .grid{grid-template-columns: 1fr}
    .hero{align-items:flex-start}
    
    /* Prevent horizontal scroll */
    body{
      overflow-x: hidden;
      width: 100%;
    }
    
    .wrap{
      padding: 0 12px;
      max-width: 100%;
      overflow-x: hidden;
    }
    
    /* Smart grid mobile adjustments */
    .grid.single-event,
    .grid.two-events,
    .grid.three-events{
      grid-template-columns: 1fr;
      max-width: none;
    }
    
    /* Timeline mobile adjustments */
    .timeline{
      padding-left: 20px;
    }
    
    .timeline::before{
      left: 10px;
    }
    
    .timeline-marker{
      left: -20px;
    }
    
    .timeline-day::before{
      left: -10px;
    }
    
    .timeline-card{
      padding: 12px;
    }
    
    .timeline-title{
      font-size: 15px;
    }
    
    /* Ensure pills wrap properly */
    .days{
      flex-wrap: wrap;
      overflow: visible;
    }
    
    .tag-filters{
      flex-wrap: wrap;
      overflow: visible;
      gap: 3px;
      margin-top: 2px;
      max-height: 32px;
      overflow-y: hidden;
    }
    
    .tag-filter{
      padding: 3px 6px;
      font-size: 10px;
      border-radius: 8px;
      white-space: nowrap;
    }
    
    .tag-icon{
      font-size: 11px;
      margin-right: 1px;
    }
    
    /* Mobile countdown adjustments */
    .countdown-timer{
      font-size: 11px;
      padding: 4px 8px;
    }
    
    .countdown-icon{
      font-size: 12px;
    }
    
    .timeline-card .countdown-timer{
      position: static;
      margin: 8px 0;
      font-size: 10px;
    }
    
    /* Mobile action button adjustments */
    .action-btn{
      padding: 5px 8px;
      font-size: 10px;
    }
    
    .action-icon{
      font-size: 11px;
    }
    
    .action-text{
      font-size: 9px;
    }
    
    .card-actions,
    .timeline-actions{
      flex-direction: column;
      gap: 6px;
    }
  }

  .daybar{
    display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin:8px 0 6px;
  }
  .daylabel{ color:var(--muted); font-weight:600 }
  .day-select{
    background:var(--surface); color:var(--text);
    border:1px solid var(--line); border-radius:12px;
    padding:10px 12px; min-width:220px; box-shadow:var(--shadow-sm);
  }
  .day-select:focus{ outline:none; box-shadow: var(--ring); border-color: var(--primary); }
  
  /* Opcional: que las píldoras envuelvan en varias filas si queda sitio */
  .days{ display:flex; gap:8px; flex-wrap:wrap; overflow:visible; padding:6px 2px }

  .flag {
    height: 60px;
    margin-right: 16px;
    border-radius: 4px;
    box-shadow: var(--shadow);
  }
  .hero {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
  }

  .regional-decoration{
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.1;
    font-size: 48px;
    animation: windmillSpin 20s linear infinite;
  }

  @keyframes windmillSpin {
    from { transform: translateY(-50%) rotate(0deg); }
    to { transform: translateY(-50%) rotate(360deg); }
  }
  
  