/* =============================================
   CSS RENOVADO - FW CALENDÁRIO BRASIL 2026
   Visual moderno, arredondado e responsivo
   ============================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 10px 40px rgba(0,0,0,0.1);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* =============================================
   HEADER PRINCIPAL MODERNO (UNIFICADO)
   ============================================= */
.main-header {
    background: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);
    background-size: 200% 200%;
    animation: gradientShift 5s ease infinite;
    color: white;
    padding: 30px 35px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    position: relative;
    overflow: hidden;
}

.main-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 50%);
    animation: headerGlow 8s ease-in-out infinite;
}

@keyframes headerGlow {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-10%, -10%); }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.header-left {
    position: relative;
    z-index: 1;
}

.header-left h1 {
    font-size: 2.2em;
    font-weight: 700;
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
    font-weight: 400;
}

.header-right {
    display: flex;
    gap: 12px;
    position: relative;
    z-index: 1;
}

/* Botões do header */
.header-btn {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.2);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.header-btn:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.header-btn i {
    font-size: 1.2em;
}

.api-btn {
    background: rgba(245,158,11,0.3);
    border-color: rgba(245,158,11,0.5);
}

.export-btn {
    background: rgba(16,185,129,0.3);
    border-color: rgba(16,185,129,0.5);
}

/* =============================================
   TOOLBAR / BARRA DE FERRAMENTAS
   ============================================= */
.toolbar {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 20px 35px;
}

/* Navegação */
.navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: var(--light);
    padding: 15px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.nav-center {
    display: flex;
    align-items: center;
    gap: 20px;
}

.month-year {
    font-size: 1.6em;
    font-weight: 700;
    min-width: 220px;
    text-align: center;
    color: var(--dark);
    letter-spacing: -0.5px;
}

/* Botões de navegação */
.nav-btn {
    background: white;
    border: 2px solid var(--border);
    color: var(--dark);
    padding: 10px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99,102,241,0.3);
}

.nav-btn:active,
.view-btn:active {
    transform: scale(0.95);
}

.today-btn {
    background: var(--accent);
    color: white;
    border: none;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(245,158,11,0.3);
}

.today-btn:hover {
    background: #d97706;
    box-shadow: 0 8px 25px rgba(245,158,11,0.4);
}

/* Visualização e Busca */
.view-search-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    flex-wrap: wrap;
    gap: 20px;
}

/* Botões de visualização */
.view-options {
    display: flex;
    gap: 8px;
    background: var(--light);
    padding: 6px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.view-btn {
    background: transparent;
    border: none;
    color: var(--gray);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.view-btn:hover {
    color: var(--dark);
    background: white;
}

.view-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99,102,241,0.3);
    font-weight: 700;
}

.view-btn.active i {
    color: white;
}

.view-label {
    font-size: 0.9em;
}

/* Caixa de busca */
.search-box {
    position: relative;
    flex: 1;
    max-width: 350px;
}

.search-box input {
    width: 100%;
    padding: 14px 45px;
    border: 2px solid var(--border);
    border-radius: 50px;
    font-size: 0.95em;
    transition: var(--transition);
    background: var(--light);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99,102,241,0.1);
    background: white;
}

.search-box i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
    font-size: 1.1em;
}

.clear-search {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--gray);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-search:hover {
    background: var(--danger);
}

/* Filtros rápidos */
.quick-filters {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.quick-filter {
    background: white;
    border: 2px solid var(--border);
    padding: 10px 20px;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--dark);
}

.quick-filter:hover {
    border-color: var(--primary);
    background: var(--light);
    transform: translateY(-2px);
}

.quick-filter.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(99,102,241,0.3);
}

/* Filtros Avançados */
.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    padding: 20px;
    background: var(--light);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 12px 18px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9em;
    font-weight: 500;
    border: 2px solid var(--border);
}

.filter-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.filter-item.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(99,102,241,0.3);
}

.toggle-filters-btn {
    width: 100%;
    margin-top: 15px;
    background: white;
    border: 2px dashed var(--border);
    padding: 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95em;
    font-weight: 600;
    color: var(--gray);
}

.toggle-filters-btn:hover {
    background: var(--light);
    border-color: var(--primary);
    color: var(--primary);
}

/* Barra de progresso do ano */
.toolbar .year-progress {
    background: #f1f5f9;
    border-radius: 50px;
    height: 6px;
    margin: 15px 0 0 0;
    overflow: hidden;
}

.year-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    border-radius: 50px;
    transition: width 0.5s ease;
    position: relative;
    width: 0%;
}

.year-progress-bar::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: white;
    border: 2px solid #6366f1;
    border-radius: 50%;
}

/* =============================================
   ESTATÍSTICAS
   ============================================= */
.stats-bar {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    padding: 18px 35px;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1em;
    font-weight: 500;
}

.stat-item span {
    font-weight: 700;
    font-size: 1.4em;
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 50px;
}

/* =============================================
   CORPO DO CALENDÁRIO
   ============================================= */
.calendar-body {
    padding: 25px;
}

/* Grid Mensal */
.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 4px;
}

.weekday-header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    padding: 14px;
    text-align: center;
    font-weight: 700;
    font-size: 0.95em;
    border-radius: var(--radius-sm);
    letter-spacing: 0.5px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    background: white;
    min-height: 110px;
    padding: 12px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    position: relative;
    animation: fadeInScale 0.3s ease-out;
    animation-fill-mode: both;
}

.calendar-day:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.1);
    z-index: 10;
}

.day-number {
    font-size: 1.2em;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--dark);
}

.day-events {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.event-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 50px;
    font-size: 0.7em;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: all 0.2s ease;
}

.event-tag:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Cores dos Eventos */
.feriado-nacional { background: #ef4444; color: white; }
.ponto-facultativo { background: #f59e0b; color: white; }
.feriado-estadual { background: #3b82f6; color: white; }
.data-comercial { background: #8b5cf6; color: white; }
.data-escolar { background: #10b981; color: white; }
.data-religiosa { background: #64748b; color: white; }
.data-familiar { background: #ec4899; color: white; }
.data-empresarial { background: #06b6d4; color: white; }
.data-ambiental { background: #84cc16; color: white; }

.feriadao {
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    color: white;
    font-weight: 700;
}

.hoje {
    background: rgba(254, 243, 199, 0.8) !important;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(245, 158, 11, 0.5) !important;
    box-shadow: 0 0 20px rgba(245,158,11,0.3);
}

.vazio {
    color: #cbd5e1;
    background: #f8fafc;
    cursor: default;
    border-style: dashed;
}

/* Animações do calendário */
@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Delays escalonados (42 células) */
.calendar-day:nth-child(1)  { animation-delay: 0.01s; }
.calendar-day:nth-child(2)  { animation-delay: 0.02s; }
.calendar-day:nth-child(3)  { animation-delay: 0.03s; }
.calendar-day:nth-child(4)  { animation-delay: 0.04s; }
.calendar-day:nth-child(5)  { animation-delay: 0.05s; }
.calendar-day:nth-child(6)  { animation-delay: 0.06s; }
.calendar-day:nth-child(7)  { animation-delay: 0.07s; }
.calendar-day:nth-child(8)  { animation-delay: 0.08s; }
.calendar-day:nth-child(9)  { animation-delay: 0.09s; }
.calendar-day:nth-child(10) { animation-delay: 0.10s; }
.calendar-day:nth-child(11) { animation-delay: 0.11s; }
.calendar-day:nth-child(12) { animation-delay: 0.12s; }
.calendar-day:nth-child(13) { animation-delay: 0.13s; }
.calendar-day:nth-child(14) { animation-delay: 0.14s; }
.calendar-day:nth-child(15) { animation-delay: 0.15s; }
.calendar-day:nth-child(16) { animation-delay: 0.16s; }
.calendar-day:nth-child(17) { animation-delay: 0.17s; }
.calendar-day:nth-child(18) { animation-delay: 0.18s; }
.calendar-day:nth-child(19) { animation-delay: 0.19s; }
.calendar-day:nth-child(20) { animation-delay: 0.20s; }
.calendar-day:nth-child(21) { animation-delay: 0.21s; }
.calendar-day:nth-child(22) { animation-delay: 0.22s; }
.calendar-day:nth-child(23) { animation-delay: 0.23s; }
.calendar-day:nth-child(24) { animation-delay: 0.24s; }
.calendar-day:nth-child(25) { animation-delay: 0.25s; }
.calendar-day:nth-child(26) { animation-delay: 0.26s; }
.calendar-day:nth-child(27) { animation-delay: 0.27s; }
.calendar-day:nth-child(28) { animation-delay: 0.28s; }
.calendar-day:nth-child(29) { animation-delay: 0.29s; }
.calendar-day:nth-child(30) { animation-delay: 0.30s; }
.calendar-day:nth-child(31) { animation-delay: 0.31s; }
.calendar-day:nth-child(32) { animation-delay: 0.32s; }
.calendar-day:nth-child(33) { animation-delay: 0.33s; }
.calendar-day:nth-child(34) { animation-delay: 0.34s; }
.calendar-day:nth-child(35) { animation-delay: 0.35s; }
.calendar-day:nth-child(36) { animation-delay: 0.36s; }
.calendar-day:nth-child(37) { animation-delay: 0.37s; }
.calendar-day:nth-child(38) { animation-delay: 0.38s; }
.calendar-day:nth-child(39) { animation-delay: 0.39s; }
.calendar-day:nth-child(40) { animation-delay: 0.40s; }
.calendar-day:nth-child(41) { animation-delay: 0.41s; }
.calendar-day:nth-child(42) { animation-delay: 0.42s; }

/* Visualização Semanal */
.week-view {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.week-day {
    background: white;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 0;
    min-height: 200px;
    overflow: hidden;
    transition: all 0.3s;
}

.week-day:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.week-day-header {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85em;
}

/* =============================================
   MODAL MODERNO
   ============================================= */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

.modal-content {
    background: white;
    margin: 3% auto;
    padding: 35px;
    border-radius: var(--radius-lg);
    max-width: 650px;
    position: relative;
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 25px 70px rgba(0,0,0,0.3);
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    cursor: pointer;
    color: var(--gray);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-modal:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* API Modal */
.api-modal {
    max-width: 850px;
    max-height: 85vh;
    overflow-y: auto;
}

.api-section {
    margin: 25px 0;
    padding: 25px;
    background: var(--light);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
}

.api-section h3 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.2em;
}

.code-block {
    background: #1e293b;
    color: #e2e8f0;
    padding: 20px;
    border-radius: var(--radius);
    margin: 15px 0;
    position: relative;
    overflow-x: auto;
}

.code-block pre {
    margin: 0;
}

.code-block code {
    font-family: 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.85em;
    line-height: 1.6;
}

.copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85em;
}

.copy-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* =============================================
   LEGENDA INTERATIVA
   ============================================= */
.legend {
    background: var(--light);
    padding: 20px 35px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 25px;
    border-top: 1px solid var(--border);
}

.legend-title {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1em;
}

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

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.9em;
    font-weight: 500;
}

.legend-item:hover {
    background: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transform: scale(1.05);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
}

.legend-note {
    color: var(--gray);
    font-size: 0.85em;
    margin-left: auto;
}

/* =============================================
   BOTÃO VOLTAR AO TOPO
   ============================================= */
.back-to-top {
    position: fixed;
    bottom: 35px;
    right: 35px;
    background: var(--primary);
    color: white;
    border: none;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.3em;
    box-shadow: 0 8px 30px rgba(99,102,241,0.4);
    transition: var(--transition);
    display: none;
    z-index: 999;
}

.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(99,102,241,0.5);
}

.back-to-top.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInUp 0.3s;
}

/* =============================================
   TOAST
   ============================================= */
.toast {
    position: fixed;
    bottom: 110px;
    right: 35px;
    background: var(--dark);
    color: white;
    padding: 16px 28px;
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    z-index: 1000;
    display: none;
    font-weight: 500;
}

.toast.show {
    display: block;
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =============================================
   FOOTER
   ============================================= */
.footer {
    background-color: transparent;
    padding: 2.5rem 0;
    margin-top: auto;
    width: 100%;
}

.footer-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem 2rem;
    text-align: center;
    color: var(--gray);
    font-size: 0.9em;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.03);
}

.footer-card a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.footer-card a:hover {
    text-decoration: underline;
}

/* =============================================
   ANIMAÇÕES GERAIS
   ============================================= */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

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

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

/* =============================================
   TEMA ESCURO
   ============================================= */
body.dark-theme {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
}

body.dark-theme .container { background: #1e293b; color: #e2e8f0; }
body.dark-theme .toolbar { background: #1e293b; border-color: #334155; }
body.dark-theme .navigation { background: #0f172a; border-color: #334155; }
body.dark-theme .month-year { color: #e2e8f0; }
body.dark-theme .nav-btn { background: #1e293b; border-color: #334155; color: #e2e8f0; }
body.dark-theme .view-options { background: #0f172a; border-color: #334155; }
body.dark-theme .view-btn { color: #94a3b8; }
body.dark-theme .view-btn:hover { color: #e2e8f0; background: #1e293b; }
body.dark-theme .calendar-day { background: #1e293b; border-color: #334155; color: #e2e8f0; }
body.dark-theme .calendar-day:hover { background: #334155; }
body.dark-theme .day-number { color: #e2e8f0; }
body.dark-theme .quick-filter { background: #1e293b; border-color: #334155; color: #e2e8f0; }
body.dark-theme .legend { background: #0f172a; border-color: #334155; }
body.dark-theme .toolbar .year-progress { background: #334155; }

/* =============================================
   RESPONSIVIDADE
   ============================================= */
@media (max-width: 1200px) {
    .container { max-width: 95%; }
    .calendar-day { min-height: 95px; }
}

@media (max-width: 992px) {
    .main-header { padding: 20px 25px; }
    .header-left h1 { font-size: 1.6em; }
    .navigation { flex-direction: column; gap: 15px; }
    .nav-center { width: 100%; justify-content: center; flex-wrap: wrap; }
    .month-year { font-size: 1.3em; min-width: auto; }
}

@media (max-width: 768px) {
    body { padding: 10px; }
    .main-header { flex-direction: column; text-align: center; padding: 20px; }
    .header-right { width: 100%; justify-content: center; }
    .header-btn { padding: 10px 16px; font-size: 0.85em; }
    .toolbar { padding: 15px; }
    .view-search-bar { flex-direction: column; }
    .view-options { width: 100%; justify-content: center; }
    .view-btn { padding: 10px 18px; font-size: 0.85em; }
    .view-label { display: none; }
    .search-box { max-width: 100%; }
    .quick-filters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 5px; -webkit-overflow-scrolling: touch; }
    .quick-filter { flex-shrink: 0; font-size: 0.8em; padding: 8px 14px; }
    .calendar-body { padding: 10px; }
    .weekday-header { padding: 10px 5px; font-size: 0.75em; }
    .calendar-day { min-height: 65px; padding: 8px; }
    .day-number { font-size: 0.9em; }
    .event-tag { font-size: 0.6em; }
    .stats-bar { flex-direction: column; padding: 15px; gap: 10px; text-align: center; }
    .legend { flex-direction: column; gap: 12px; padding: 15px; }
    .modal-content { margin: 15px; padding: 20px; border-radius: var(--radius); }
    .week-view { grid-template-columns: 1fr; gap: 10px; }
    .week-day { min-height: auto !important; }
    .week-day-header { font-size: 0.9em; }
}

@media (max-width: 480px) {
    body { padding: 5px; }
    .main-header { padding: 15px; }
    .header-left h1 { font-size: 1.2em; }
    .header-btn { padding: 8px 12px; font-size: 0.8em; }
    .navigation { padding: 10px; }
    .nav-btn { padding: 8px 12px; font-size: 0.85em; }
    .month-year { font-size: 1.1em; }
    .view-btn { padding: 8px 12px; font-size: 0.8em; }
    .calendar-day { min-height: 50px; padding: 5px; }
    .day-number { font-size: 0.75em; }
    .weekday-header { padding: 8px 2px; font-size: 0.65em; }
    .filters-grid { grid-template-columns: repeat(2, 1fr); }
    .back-to-top { width: 45px; height: 45px; bottom: 20px; right: 20px; }
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
    .nav-btn, .view-btn, .filter-item, .calendar-day, .header-btn, .quick-filter {
        min-height: 44px;
    }
}

/* Acessibilidade - Reduzir animações */
@media (prefers-reduced-motion: reduce) {
    .calendar-day { animation: none !important; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}