/**
 * EloBase ERP - Calendar Styles v3.1
 * Design shadcn/ui consistente com o sistema
 * ESCOPO: #page-agenda, #event-modal, #calendar-modal, #google-import-modal
 */

/* =====================================================
   PÁGINA AGENDA - FULLSCREEN COM PADDING
   ===================================================== */

/* Quando a agenda está ativa, ajustar layout */
.main-content:has(#page-agenda.active) {
    padding: 24px;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
    box-sizing: border-box;
}

/* Esconder o header quando a agenda está ativa para maximizar espaço */
.main-content:has(#page-agenda.active) > .main-header {
    display: none;
}

#page-agenda {
    display: none;
    flex-direction: column;
    height: calc(100vh - 48px);
    height: calc(100dvh - 48px);
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    overflow: hidden !important;
    padding: 0;
    box-sizing: border-box;
}

#page-agenda.active {
    display: flex !important;
}

/* =====================================================
   CONTAINER PRINCIPAL - GOOGLE CALENDAR STYLE
   ===================================================== */

#page-agenda .calendar-container {
    display: flex;
    flex: 1;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    background: var(--card, #ffffff);
    border-radius: var(--radius-lg, 0.5rem);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

/* =====================================================
   SIDEBAR - ESTILO GOOGLE CALENDAR
   ===================================================== */

#page-agenda .calendar-sidebar {
    width: 256px;
    min-width: 256px;
    background: var(--sidebar, #fafafa);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 100%;
    transition: width var(--transition-normal, 200ms), min-width var(--transition-normal, 200ms);
    position: relative;
}

/* Sidebar header - layout flexbox para evitar sobreposição */
#page-agenda .sidebar-header {
    padding: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

#page-agenda .sidebar-header .btn-new-event {
    flex: 1;
}

/* Botão de toggle da sidebar */
#page-agenda .sidebar-toggle {
    width: 32px;
    height: 32px;
    padding: 0;
    background: var(--card, #ffffff);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 0.375rem);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground);
    transition: all var(--transition-fast, 150ms);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

#page-agenda .sidebar-toggle:hover {
    background: var(--accent);
    color: var(--accent-foreground);
    box-shadow: var(--shadow-md);
}

#page-agenda .sidebar-toggle svg {
    transition: transform var(--transition-normal, 200ms);
}

/* Sidebar recolhida */
#page-agenda .calendar-sidebar.collapsed {
    width: 56px;
    min-width: 56px;
}

#page-agenda .calendar-sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

#page-agenda .calendar-sidebar.collapsed .sidebar-header {
    padding: 12px;
    padding-top: 27px;
    flex-direction: row;
    gap: 8px;
}

#page-agenda .calendar-sidebar.collapsed .btn-new-event {
    display: none;
}

#page-agenda .calendar-sidebar.collapsed .calendars-section,
#page-agenda .calendar-sidebar.collapsed .google-calendar-wrapper {
    display: none;
}

#page-agenda .sidebar-header h3 {
    display: none;
}

/* Botão Criar - Estilo shadcn */
#page-agenda .btn-new-event {
    width: 100%;
    padding: 0 16px;
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: var(--radius-md, 0.375rem);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity var(--transition-fast, 150ms), background var(--transition-fast, 150ms);
    height: 40px;
}

#page-agenda .btn-new-event:hover {
    opacity: 0.9;
}

#page-agenda .btn-new-event svg {
    width: 18px;
    height: 18px;
    color: currentColor;
}

/* Lista de Calendários */
#page-agenda .calendars-section {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px 16px 16px;
    min-height: 0;
}

#page-agenda .calendars-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 8px 0;
}

#page-agenda .calendars-section-header h4 {
    margin: 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#page-agenda .btn-add-calendar {
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm, 0.25rem);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground);
    transition: all var(--transition-fast, 150ms);
}

#page-agenda .btn-add-calendar:hover {
    background: var(--accent);
    color: var(--accent-foreground);
}

#page-agenda #calendars-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#page-agenda .calendar-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: var(--radius-sm, 0.25rem);
    transition: background-color var(--transition-fast, 150ms);
    margin-left: -8px;
    margin-right: -8px;
}

#page-agenda .calendar-item:hover {
    background: var(--accent);
}

#page-agenda .calendar-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    flex: 1;
}

#page-agenda .calendar-checkbox input[type="checkbox"] {
    display: none;
}

#page-agenda .calendar-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
    transition: all 0.15s;
}

#page-agenda .calendar-checkbox input:checked + .calendar-color {
    box-shadow: none;
}

#page-agenda .calendar-checkbox input:not(:checked) + .calendar-color {
    opacity: 0.4;
    background: transparent !important;
    border: 2px solid currentColor;
}

#page-agenda .calendar-name {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-primary, #3c4043);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#page-agenda .google-sync-icon {
    margin-left: 4px;
    flex-shrink: 0;
    opacity: 0.8;
}

#page-agenda .calendar-actions {
    display: none;
}

#page-agenda .calendar-item:hover .calendar-actions {
    display: flex;
}

#page-agenda .btn-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary, #5f6368);
    transition: all 0.15s;
}

#page-agenda .btn-icon:hover {
    background: var(--bg-hover, #e8eaed);
    color: var(--text-primary, #202124);
}

/* =====================================================
   MINI CALENDÁRIO NA SIDEBAR
   ===================================================== */

#page-agenda .mini-calendar-section {
    padding: 0 16px 16px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

#page-agenda .mini-calendar-widget {
    background: var(--background);
    border-radius: var(--radius-lg);
    padding: 12px;
    border: 1px solid var(--border);
}

#page-agenda .mini-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

#page-agenda .mini-cal-nav {
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground);
    transition: all 150ms;
}

#page-agenda .mini-cal-nav:hover {
    background: var(--accent);
    color: var(--foreground);
}

#page-agenda .mini-cal-month-year {
    font-size: 13px;
    font-weight: 600;
    color: var(--foreground);
}

#page-agenda .mini-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    margin-bottom: 4px;
}

#page-agenda .mini-calendar-weekdays span {
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--muted-foreground);
    padding: 4px 0;
}

#page-agenda .mini-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

#page-agenda .mini-cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--foreground);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 150ms;
    position: relative;
}

#page-agenda .mini-cal-day:hover {
    background: var(--accent);
    color: var(--foreground);
}

#page-agenda .mini-cal-day.other-month {
    color: var(--muted-foreground);
    opacity: 0.5;
}

#page-agenda .mini-cal-day.today {
    background: var(--primary);
    color: var(--primary-foreground);
    font-weight: 600;
}

#page-agenda .mini-cal-day.today:hover {
    background: #3b77db;
    color: #ffffff;
}

#page-agenda .mini-cal-day.selected {
    font-weight: 600;
    box-shadow: inset 0 0 0 2px var(--primary);
}

#page-agenda .mini-cal-day.has-events::after {
    content: '';
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
}

#page-agenda .mini-cal-day.today.has-events::after {
    background: var(--primary-foreground);
}

/* Lista de eventos do dia */
#page-agenda .day-events-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

#page-agenda .day-events-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 0 4px;
}

#page-agenda .day-events-date {
    font-size: 12px;
    font-weight: 500;
    color: var(--foreground);
}

#page-agenda .btn-add-event-mini {
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground);
    transition: all 150ms;
}

#page-agenda .btn-add-event-mini:hover {
    background: var(--accent);
    color: var(--foreground);
}

#page-agenda .day-events-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
}

#page-agenda .day-event-item {
    background: var(--accent);
    border-radius: var(--radius-md);
    padding: 8px 10px 8px 14px;
    position: relative;
    cursor: pointer;
    transition: all 150ms;
}

#page-agenda .day-event-item:hover {
    background: var(--accent);
    filter: brightness(0.95);
}

#page-agenda .day-event-item::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 2px;
    background: var(--event-color, var(--primary));
}

#page-agenda .day-event-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--foreground);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#page-agenda .day-event-time {
    font-size: 11px;
    color: var(--muted-foreground);
}

#page-agenda .no-events {
    font-size: 12px;
    color: var(--muted-foreground);
    text-align: center;
    padding: 16px 8px;
}

/* Esconder mini calendário quando sidebar recolhida */
#page-agenda .calendar-sidebar.collapsed .mini-calendar-section {
    display: none;
}

/* =====================================================
   ÁREA PRINCIPAL DO CALENDÁRIO
   ===================================================== */

#page-agenda .calendar-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary, #ffffff);
    position: relative;
    min-height: 0;
    height: 100%;
    transition: flex 0.3s ease;
    padding-top: 8px; /* Puxar calendário um pouco para baixo */
}

#page-agenda #fullcalendar {
    flex: 1 1 auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    height: 100%;
}

#page-agenda #fullcalendar .fc {
    flex: 1 1 auto;
    height: 100% !important;
    min-height: 0;
    max-height: 100% !important;
}

/* Scroll INTERNO no FullCalendar */
#page-agenda .fc .fc-view-harness {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    height: 100% !important;
}

#page-agenda .fc .fc-view {
    height: 100% !important;
    display: flex;
    flex-direction: column;
}

#page-agenda .fc .fc-scroller {
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

#page-agenda .fc .fc-scroller-harness {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    height: 100% !important;
}

#page-agenda .fc .fc-scroller-harness-liquid {
    height: 100% !important;
}

#page-agenda .fc-timeGridWeek-view .fc-timegrid-body,
#page-agenda .fc-timeGridDay-view .fc-timegrid-body {
    min-height: 0;
}

#page-agenda .fc-dayGridMonth-view .fc-scroller {
    overflow-y: auto !important;
}

/* Loading */
#page-agenda #calendar-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: hsl(var(--background) / 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

#page-agenda .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: calendarSpin 1s linear infinite;
}

@keyframes calendarSpin {
    to { transform: rotate(360deg); }
}

/* =====================================================
   FULLCALENDAR CUSTOMIZAÇÃO - ESTILO SHADCN
   ===================================================== */

/* Header Toolbar */
#page-agenda .fc .fc-toolbar {
    margin-bottom: 0;
    flex-shrink: 0;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}

#page-agenda .fc .fc-toolbar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--foreground);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

#page-agenda .fc .fc-button {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted-foreground);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: var(--radius-md, 0.375rem);
    transition: all 0.2s ease, transform 0.15s ease;
    text-transform: none;
    outline: none;
    box-shadow: none;
}

#page-agenda .fc .fc-button:focus {
    outline: none;
    box-shadow: none;
}

#page-agenda .fc .fc-button:hover:not(.fc-button-active) {
    background: var(--accent);
    color: var(--accent-foreground);
    border-color: var(--border);
    transform: translateY(-1px);
}

#page-agenda .fc .fc-button:active:not(.fc-button-active) {
    transform: translateY(0) scale(0.98);
}

#page-agenda .fc .fc-button:disabled {
    opacity: 0.5;
    color: var(--muted-foreground);
}

#page-agenda .fc .fc-button-primary:not(:disabled).fc-button-active {
    background: var(--secondary);
    border-color: var(--border);
    color: var(--foreground);
    font-weight: 600;
    box-shadow: none;
}

#page-agenda .fc .fc-button-primary:not(:disabled).fc-button-active:focus {
    outline: none;
    box-shadow: none;
}

#page-agenda .fc .fc-button-primary:not(:disabled):active:not(.fc-button-active) {
    background: var(--accent);
    border-color: var(--border);
    color: var(--foreground);
}

#page-agenda .fc .fc-button-group > .fc-button {
    border-radius: 0;
    position: relative;
}

#page-agenda .fc .fc-button-group > .fc-button:first-child {
    border-radius: var(--radius-md, 0.375rem) 0 0 var(--radius-md, 0.375rem);
}

#page-agenda .fc .fc-button-group > .fc-button:last-child {
    border-radius: 0 var(--radius-md, 0.375rem) var(--radius-md, 0.375rem) 0;
}

/* Remover todas as sombras de foco dos botões do calendário */
#page-agenda .fc .fc-button-group > .fc-button:focus,
#page-agenda .fc .fc-button-group > .fc-button:focus-visible {
    outline: none;
    box-shadow: none;
    z-index: 1;
}

/* Animação suave ao trocar de visualização */
#page-agenda .fc .fc-button-group > .fc-button.fc-button-active {
    animation: viewButtonActivate 0.2s ease;
}

@keyframes viewButtonActivate {
    0% {
        transform: scale(0.95);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

/* Botões de navegação */
#page-agenda .fc .fc-prev-button,
#page-agenda .fc .fc-next-button {
    padding: 8px;
    border-radius: var(--radius-md, 0.375rem);
    width: 36px;
    height: 36px;
}

/* Today Button */
#page-agenda .fc .fc-today-button {
    margin-right: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 0.375rem);
    padding: 8px 16px;
    font-weight: 500;
}

#page-agenda .fc .fc-today-button:hover {
    background: var(--accent);
    border-color: var(--border);
}

/* Day Grid - Estilo shadcn */
#page-agenda .fc .fc-daygrid-day {
    transition: background-color var(--transition-fast, 150ms);
    border-color: hsl(240 5.9% 90% / 0.55);
}

#page-agenda .fc .fc-daygrid-day:hover {
    background: var(--accent);
}

#page-agenda .fc .fc-daygrid-day.fc-day-today {
    background: hsl(var(--primary) / 0.05);
}

#page-agenda .fc .fc-daygrid-day-number {
    font-size: 13px;
    font-weight: 500;
    color: var(--muted-foreground);
    padding: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 4px;
    border-radius: var(--radius-sm, 0.25rem);
}

#page-agenda .fc .fc-day-today .fc-daygrid-day-number {
    background: var(--primary);
    color: var(--primary-foreground);
    font-weight: 600;
}

/* Column Headers */
#page-agenda .fc .fc-col-header-cell {
    padding: 12px 0;
    background: transparent;
    border-bottom: 1px solid hsl(240 5.9% 90% / 0.55);
    font-weight: 500;
}

#page-agenda .fc .fc-col-header-cell-cushion {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#page-agenda .fc .fc-day-today .fc-col-header-cell-cushion {
    color: var(--primary);
}

/* Events - Estilo shadcn */
#page-agenda .fc-event {
    border-radius: var(--radius-sm, 0.25rem);
    border: none;
    padding: 2px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: opacity var(--transition-fast, 150ms);
    border-left: none;
}

#page-agenda .fc-event:hover {
    opacity: 0.85;
}

#page-agenda .fc-event .fc-event-title {
    font-weight: 500;
}

#page-agenda .fc-event .fc-event-time {
    font-weight: 400;
    opacity: 0.9;
}

#page-agenda .fc-event .event-type-icon {
    margin-right: 4px;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    opacity: 0.85;
}

#page-agenda .fc-event .event-type-icon svg {
    width: 11px;
    height: 11px;
}

/* Espaçamento entre eventos empilhados */
#page-agenda .fc-daygrid-event-harness {
    margin-bottom: 2px;
}

#page-agenda .fc-daygrid-day-events {
    padding: 2px 4px 4px;
}

#page-agenda .fc-timegrid-event-harness {
    margin-bottom: 1px;
}

/* Eventos sincronizados com Google */
#page-agenda .fc-event.synced-google::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%234285F4' d='M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z'/%3E%3Cpath fill='%2334A853' d='M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z'/%3E%3Cpath fill='%23FBBC05' d='M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z'/%3E%3Cpath fill='%23EA4335' d='M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
    opacity: 0.8;
}

/* Time Grid - Visualização Semanal/Diária */
#page-agenda .fc .fc-timegrid-slot {
    height: 20px;
    border-color: hsl(240 5.9% 90% / 0.45);
}

#page-agenda .fc .fc-timegrid-slot-minor {
    border-top-style: dotted;
    border-top-color: hsl(240 5.9% 90% / 0.30);
}

#page-agenda .fc .fc-timegrid-slot-label {
    font-size: 10px;
    color: var(--muted-foreground);
    padding-right: 8px;
    vertical-align: top;
    padding-top: 0;
    line-height: 20px;
}

#page-agenda .fc .fc-timegrid-now-indicator-line {
    border-color: var(--destructive);
    border-width: 2px;
}

#page-agenda .fc .fc-timegrid-now-indicator-arrow {
    border-color: var(--destructive);
    border-top-color: transparent;
    border-bottom-color: transparent;
}

#page-agenda .fc .fc-timegrid {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    height: 100% !important;
}

#page-agenda .fc .fc-timegrid-divider {
    display: none;
}

#page-agenda .fc .fc-timegrid-body {
    overflow: visible;
}

#page-agenda .fc .fc-scroller-liquid-absolute {
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    scrollbar-width: thin;
}

#page-agenda .fc-timeGridWeek-view,
#page-agenda .fc-timeGridDay-view {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

#page-agenda .fc-timeGridWeek-view > table,
#page-agenda .fc-timeGridDay-view > table {
    flex: 1;
    min-height: 0;
}

/* Scrollbar customizada */
#page-agenda .fc .fc-scroller::-webkit-scrollbar {
    width: 8px;
}

#page-agenda .fc .fc-scroller::-webkit-scrollbar-track {
    background: transparent;
}

#page-agenda .fc .fc-scroller::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-sm, 0.25rem);
}

#page-agenda .fc .fc-scroller::-webkit-scrollbar-thumb:hover {
    background: var(--muted-foreground);
}

#page-agenda .fc .fc-timegrid-axis {
    width: 56px;
    min-width: 56px;
}

#page-agenda .fc .fc-timegrid-col {
    min-width: 100px;
}

#page-agenda .fc .fc-timegrid-event {
    border-radius: var(--radius-sm, 0.25rem);
    border: none;
    box-shadow: var(--shadow-sm);
    font-size: 11px;
    overflow: hidden;
    margin: 0 2px;
}

#page-agenda .fc .fc-timegrid-event .fc-event-main {
    padding: 4px 8px;
}

#page-agenda .fc .fc-timegrid-event .fc-event-time {
    font-size: 10px;
    font-weight: 500;
    margin-bottom: 2px;
}

#page-agenda .fc .fc-timegrid-event .fc-event-title {
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
}

#page-agenda .fc .fc-timegrid-event-harness {
    margin-right: 2px;
}

#page-agenda .fc .fc-timegrid-body table {
    border-collapse: collapse;
}

/* List View */
#page-agenda .fc .fc-list {
    border-radius: var(--radius-lg, 0.5rem);
    border: 1px solid var(--border);
}

#page-agenda .fc .fc-list-day-cushion {
    background: var(--muted);
    padding: 8px 16px;
}

#page-agenda .fc .fc-list-event:hover td {
    background: var(--accent);
}

/* Table borders - linhas com opacidade ajustada */
#page-agenda .fc table {
    border-color: hsl(240 5.9% 90% / 0.55);
}

#page-agenda .fc th,
#page-agenda .fc td {
    border-color: hsl(240 5.9% 90% / 0.55);
}

/* =====================================================
   MODAL DE EVENTO - #event-modal
   ===================================================== */

#event-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: hsl(0 0% 0% / 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#event-modal.show {
    display: flex;
}

#event-modal .modal-dialog {
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

#event-modal .modal-dialog.modal-sm {
    max-width: 400px;
}

#event-modal .modal-dialog.modal-lg {
    max-width: 800px;
}

#event-modal .modal-content {
    background: var(--card);
    border-radius: var(--radius-lg, 0.5rem);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    max-height: 100%;
    overflow: hidden;
    border: 1px solid var(--border);
}

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

#event-modal .modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--foreground);
}

#event-modal .modal-close {
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm, 0.25rem);
    font-size: 20px;
    color: var(--muted-foreground);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast, 150ms);
}

#event-modal .modal-close:hover {
    background: var(--accent);
    color: var(--accent-foreground);
}

#event-modal .modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

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

/* Formulário do Modal de Evento */
#event-modal .form-group {
    margin-bottom: 16px;
}

#event-modal .form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--foreground);
}

#event-modal .form-control {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid var(--input);
    border-radius: var(--radius-md, 0.375rem);
    background: var(--background);
    color: var(--foreground);
    transition: border-color var(--transition-fast, 150ms), box-shadow var(--transition-fast, 150ms);
    box-sizing: border-box;
}

#event-modal .form-control:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

#event-modal .form-control::placeholder {
    color: var(--muted-foreground);
}

#event-modal textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

/* Select com design igual ao animated select de clientes */
#event-modal select.form-control {
    appearance: none;
    padding: 10px 14px;
    padding-right: 40px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--foreground, #1e293b);
    background-color: var(--background, #ffffff);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#event-modal select.form-control:hover {
    border-color: var(--ring, #94a3b8);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

#event-modal select.form-control:focus {
    outline: none;
    border-color: var(--ring, #1f2937);
    box-shadow: 0 0 0 2px var(--background, #fff), 0 0 0 3px var(--ring, #1f2937);
}

#event-modal select.form-control:active {
    transform: scale(0.98);
}

/* Estilização das opções do select */
#event-modal select.form-control option {
    padding: 10px 14px;
    font-size: 0.8125rem;
    font-weight: 500;
    background: var(--background, #ffffff);
    color: var(--foreground, #1e293b);
}

#event-modal select.form-control option:checked {
    background: var(--accent, #f1f5f9);
}

#event-modal select.form-control option:hover {
    background: var(--accent, #f1f5f9);
}

#event-modal input[type="color"].form-control {
    height: 40px;
    padding: 4px;
    cursor: pointer;
}

/* Custom Datetime Picker */
#event-modal .datetime-picker {
    position: relative;
}

#event-modal .datetime-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    background: var(--background);
    border: 1px solid var(--input);
    border-radius: var(--radius-md, 0.375rem);
    color: var(--foreground);
    cursor: pointer;
    transition: border-color 150ms, box-shadow 150ms;
    text-align: left;
}

#event-modal .datetime-trigger:hover {
    border-color: var(--ring);
}

#event-modal .datetime-trigger:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

#event-modal .datetime-trigger svg:first-child {
    color: var(--muted-foreground);
    flex-shrink: 0;
}

#event-modal .datetime-trigger .datetime-display {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#event-modal .datetime-trigger .datetime-display.placeholder {
    color: var(--muted-foreground);
}

#event-modal .datetime-trigger .chevron {
    color: var(--muted-foreground);
    flex-shrink: 0;
    transition: transform 150ms;
}

#event-modal .datetime-trigger.open .chevron {
    transform: rotate(180deg);
}

/* Datetime Dropdown */
.datetime-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    margin-top: 4px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 0.5rem);
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.2);
    overflow: hidden;
}

.datetime-dropdown-content {
    display: flex;
}

/* Calendar Section */
.datetime-dropdown .calendar-section {
    padding: 16px;
    border-right: 1px solid var(--border);
}

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

.datetime-dropdown .calendar-month-year {
    font-size: 14px;
    font-weight: 600;
    color: var(--foreground);
}

.datetime-dropdown .calendar-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--foreground);
    cursor: pointer;
    transition: background 150ms, border-color 150ms;
}

.datetime-dropdown .calendar-nav:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.datetime-dropdown .calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 36px);
    gap: 2px;
    margin-bottom: 8px;
}

.datetime-dropdown .calendar-weekdays span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted-foreground);
}

.datetime-dropdown .calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 36px);
    gap: 2px;
}

.datetime-dropdown .calendar-day {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 14px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--foreground);
    cursor: pointer;
    transition: background 150ms, color 150ms;
}

.datetime-dropdown .calendar-day:hover:not(.selected):not(.disabled) {
    background: var(--accent);
}

.datetime-dropdown .calendar-day.today {
    border: 1px solid var(--primary);
}

.datetime-dropdown .calendar-day.selected {
    background: var(--primary);
    color: var(--primary-foreground);
    font-weight: 500;
}

.datetime-dropdown .calendar-day.other-month {
    color: var(--muted-foreground);
    opacity: 0.5;
}

.datetime-dropdown .calendar-day.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Time Section */
.datetime-dropdown .time-section {
    width: 120px;
    display: flex;
    flex-direction: column;
}

.datetime-dropdown .time-section-header {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--foreground);
    border-bottom: 1px solid var(--border);
}

.datetime-dropdown .time-slots {
    flex: 1;
    overflow-y: auto;
    max-height: 280px;
    padding: 8px;
}

.datetime-dropdown .time-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 4px;
    font-size: 13px;
    font-family: inherit;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--foreground);
    cursor: pointer;
    transition: all 150ms;
}

.datetime-dropdown .time-slot:last-child {
    margin-bottom: 0;
}

.datetime-dropdown .time-slot:hover:not(.selected) {
    background: var(--accent);
    border-color: var(--accent);
}

.datetime-dropdown .time-slot.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-foreground);
    font-weight: 500;
}

/* Form Row */
#event-modal .form-row {
    display: flex;
    gap: 16px;
}

#event-modal .form-row .form-group {
    flex: 1;
}

#event-modal .form-row-3 {
    gap: 12px;
}

#event-modal .form-group-color {
    flex: 0 0 auto;
    width: 80px;
}

/* Color Picker */
#event-modal .color-picker {
    position: relative;
}

#event-modal .color-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    padding: 8px 10px;
    background: var(--background);
    border: 1px solid var(--input);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color 150ms, box-shadow 150ms;
}

#event-modal .color-trigger:hover {
    border-color: var(--ring);
}

#event-modal .color-trigger:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

#event-modal .color-preview {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-sm);
    background: #4285f4;
    border: 1px solid rgba(0,0,0,0.1);
}

#event-modal .color-trigger .chevron {
    color: var(--muted-foreground);
    transition: transform 150ms;
}

#event-modal .color-trigger.open .chevron {
    transform: rotate(180deg);
}

#event-modal .color-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1001;
    margin-top: 4px;
    padding: 8px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.2);
}

#event-modal .color-dropdown.show {
    display: block;
}

#event-modal .color-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

#event-modal .color-option {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 150ms, border-color 150ms;
}

#event-modal .color-option:hover {
    transform: scale(1.1);
}

#event-modal .color-option.selected {
    border-color: var(--foreground);
}

#event-modal .color-option[data-color="#4285f4"] { background: #4285f4; }
#event-modal .color-option[data-color="#34a853"] { background: #34a853; }
#event-modal .color-option[data-color="#fbbc04"] { background: #fbbc04; }
#event-modal .color-option[data-color="#ea4335"] { background: #ea4335; }
#event-modal .color-option[data-color="#ff6d01"] { background: #ff6d01; }
#event-modal .color-option[data-color="#46bdc6"] { background: #46bdc6; }
#event-modal .color-option[data-color="#7c4dff"] { background: #7c4dff; }
#event-modal .color-option[data-color="#e91e63"] { background: #e91e63; }
#event-modal .color-option[data-color="#9e9e9e"] { background: #9e9e9e; }
#event-modal .color-option[data-color="#795548"] { background: #795548; }

/* Checkbox */
#event-modal .form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

#event-modal .form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

#event-modal .form-check label {
    margin: 0;
    cursor: pointer;
    font-size: 14px;
    color: var(--foreground);
}

/* Tabs no Modal */
#event-modal .modal-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

#event-modal .modal-tab {
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all var(--transition-fast, 150ms);
    margin-bottom: -1px;
}

#event-modal .modal-tab:hover {
    color: var(--foreground);
    background: var(--accent);
}

#event-modal .modal-tab.active {
    color: var(--foreground);
    border-bottom-color: var(--primary);
}

#event-modal .tab-content {
    display: none;
}

#event-modal .tab-content.active {
    display: block;
}

/* Botões do Modal de Evento */
#event-modal .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-md, 0.375rem);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast, 150ms);
}

#event-modal .btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
}

#event-modal .btn-primary:hover {
    opacity: 0.9;
}

#event-modal .btn-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
    border: 1px solid var(--border);
}

#event-modal .btn-secondary:hover {
    background: var(--accent);
}

#event-modal .btn-danger {
    background: transparent;
    background-image: linear-gradient(to right, hsl(0 84.2% 60.2%), hsl(0 84.2% 60.2% / 0.6), hsl(0 84.2% 60.2%));
    background-size: 200% auto;
    background-position: 0% center;
    color: white;
    transition: background-position 0.3s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

#event-modal .btn-danger:hover {
    background-position: 99% center;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

#event-modal .btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* =====================================================
   MODAL DE CALENDÁRIO - #calendar-modal
   ===================================================== */

#calendar-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: hsl(0 0% 0% / 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#calendar-modal.show {
    display: flex;
}

#calendar-modal .modal-dialog {
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

#calendar-modal .modal-content {
    background: var(--card);
    border-radius: var(--radius-lg, 0.5rem);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    max-height: 100%;
    overflow: hidden;
    border: 1px solid var(--border);
}

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

#calendar-modal .modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--foreground);
}

#calendar-modal .modal-close {
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm, 0.25rem);
    font-size: 20px;
    color: var(--muted-foreground);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast, 150ms);
}

#calendar-modal .modal-close:hover {
    background: var(--accent);
    color: var(--accent-foreground);
}

#calendar-modal .modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

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

/* Formulário do Modal de Calendário */
#calendar-modal .form-group {
    margin-bottom: 16px;
}

#calendar-modal .form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--foreground);
}

#calendar-modal .form-control {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid var(--input);
    border-radius: var(--radius-md, 0.375rem);
    background: var(--background);
    color: var(--foreground);
    transition: border-color var(--transition-fast, 150ms), box-shadow var(--transition-fast, 150ms);
    box-sizing: border-box;
}

#calendar-modal .form-control:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

#calendar-modal input[type="color"].form-control {
    height: 40px;
    padding: 4px;
    cursor: pointer;
}

/* Botões do Modal de Calendário */
#calendar-modal .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-md, 0.375rem);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast, 150ms);
}

#calendar-modal .btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
}

#calendar-modal .btn-primary:hover {
    opacity: 0.9;
}

#calendar-modal .btn-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
    border: 1px solid var(--border);
}

#calendar-modal .btn-secondary:hover {
    background: var(--accent);
}

#calendar-modal .btn-danger {
    background: transparent;
    background-image: linear-gradient(to right, hsl(0 84.2% 60.2%), hsl(0 84.2% 60.2% / 0.6), hsl(0 84.2% 60.2%));
    background-size: 200% auto;
    background-position: 0% center;
    color: white;
    transition: background-position 0.3s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

#calendar-modal .btn-danger:hover {
    background-position: 99% center;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

/* =====================================================
   GOOGLE CALENDAR - BOTÃO E DROPDOWN
   ===================================================== */

#page-agenda .google-calendar-wrapper {
    position: relative;
    padding: 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    margin-top: auto;
}

#page-agenda .btn-google-calendar {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 0.375rem);
    font-size: 13px;
    font-weight: 500;
    color: var(--foreground);
    cursor: pointer;
    transition: all var(--transition-fast, 150ms);
}

#page-agenda .btn-google-calendar:hover {
    background: var(--accent);
}

#page-agenda .btn-google-calendar.active {
    background: var(--accent);
    border-color: var(--primary);
}

#page-agenda .btn-google-calendar .google-icon {
    flex-shrink: 0;
}

#page-agenda .btn-google-calendar span {
    flex: 1;
    text-align: left;
}

#page-agenda .btn-google-calendar .chevron-icon {
    flex-shrink: 0;
    transition: transform 0.15s;
    color: var(--text-secondary, #5f6368);
}

#page-agenda .btn-google-calendar.active .chevron-icon {
    transform: rotate(180deg);
}

/* Dropdown Menu */
#page-agenda .google-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 16px;
    right: 16px;
    background: var(--bg-primary, #ffffff);
    border: 1px solid var(--border-color, #dadce0);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 8px 3px rgba(60, 64, 67, 0.15), 0 1px 3px rgba(60, 64, 67, 0.3);
    z-index: 100;
    animation: dropdownSlideUp 0.15s ease-out;
}

#page-agenda .google-dropdown.show {
    display: block;
}

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

#page-agenda .google-status {
    margin-bottom: 12px;
}

#page-agenda .google-connected,
#page-agenda .google-disconnected {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary, #5f6368);
    flex-wrap: wrap;
}

#page-agenda .google-connected {
    color: #188038;
}

#page-agenda .google-connected small {
    width: 100%;
    font-size: 11px;
    color: var(--text-secondary, #5f6368);
    margin-left: 22px;
    margin-top: -4px;
}

#page-agenda .status-loading {
    font-size: 12px;
    color: var(--text-secondary, #5f6368);
    font-style: italic;
}

#page-agenda .google-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#page-agenda .btn-google {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border-color, #dadce0);
    border-radius: 4px;
    background: var(--bg-primary, #ffffff);
    color: var(--text-primary, #3c4043);
    cursor: pointer;
    transition: all 0.15s;
}

#page-agenda .btn-google:hover {
    background: var(--bg-hover, #f1f3f4);
}

#page-agenda .btn-google-connect {
    width: 100%;
    justify-content: center;
    padding: 10px 16px;
    background: #ffffff;
    border: 1px solid #dadce0;
}

#page-agenda .btn-google-connect:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3);
}

#page-agenda .btn-google-sync {
    flex: 1;
}

#page-agenda .btn-google-import {
    flex: 1;
}

#page-agenda .btn-google-disconnect {
    padding: 8px;
    color: #d93025;
    border-color: #f5c6cb;
}

#page-agenda .btn-google-disconnect:hover {
    background: #fce8e6;
    border-color: #d93025;
}

/* =====================================================
   MODAL DE IMPORTAÇÃO GOOGLE - #google-import-modal
   ===================================================== */

#google-import-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#google-import-modal.show {
    display: flex;
}

#google-import-modal .modal-dialog {
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

#google-import-modal .modal-content {
    background: var(--bg-primary, #ffffff);
    border-radius: 8px;
    box-shadow: 0 24px 38px 3px rgba(0, 0, 0, 0.14), 0 9px 46px 8px rgba(0, 0, 0, 0.12), 0 11px 15px -7px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    max-height: 100%;
    overflow: hidden;
}

#google-import-modal .modal-header {
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#google-import-modal .modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 400;
    color: var(--text-primary, #202124);
    display: flex;
    align-items: center;
    gap: 12px;
}

#google-import-modal .modal-close {
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    color: var(--text-secondary, #5f6368);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s;
}

#google-import-modal .modal-close:hover {
    background: var(--bg-hover, #f1f3f4);
}

#google-import-modal .modal-body {
    padding: 0 24px 24px;
    overflow-y: auto;
    flex: 1;
}

#google-import-modal .modal-description {
    margin: 0 0 16px 0;
    color: var(--text-secondary, #5f6368);
    font-size: 14px;
}

#google-import-modal .modal-footer {
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid var(--border-color, #dadce0);
}

/* Google Calendars List */
#google-import-modal .google-calendars-list {
    max-height: 400px;
    overflow-y: auto;
}

#google-import-modal .google-calendar-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border: 1px solid var(--border-color, #dadce0);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background-color 0.15s;
}

#google-import-modal .google-calendar-item:hover {
    background: var(--bg-hover, #f1f3f4);
}

#google-import-modal .google-calendar-item.imported {
    background: #e6f4ea;
    border-color: #34a853;
}

#google-import-modal .google-calendar-item .calendar-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

#google-import-modal .google-calendar-item .calendar-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

#google-import-modal .google-calendar-item .calendar-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#google-import-modal .google-calendar-item .calendar-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #202124);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#google-import-modal .google-calendar-item .calendar-desc {
    font-size: 12px;
    color: var(--text-secondary, #5f6368);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#google-import-modal .google-calendar-item .calendar-action {
    flex-shrink: 0;
    margin-left: 12px;
}

#google-import-modal .badge {
    display: inline-block;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 12px;
}

#google-import-modal .badge-success {
    background: #e6f4ea;
    color: #188038;
}

#google-import-modal .loading-text,
#google-import-modal .empty-text,
#google-import-modal .error-text {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary, #5f6368);
    font-size: 14px;
}

#google-import-modal .error-text {
    color: #d93025;
}

/* Botões do Modal de Importação */
#google-import-modal .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 24px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

#google-import-modal .btn-primary {
    background: var(--primary-color, #1a73e8);
    color: white;
}

#google-import-modal .btn-primary:hover {
    background: #1557b0;
}

#google-import-modal .btn-secondary {
    background: transparent;
    color: var(--primary-color, #1a73e8);
}

#google-import-modal .btn-secondary:hover {
    background: #e8f0fe;
}

#google-import-modal .btn-sm {
    padding: 6px 16px;
    font-size: 13px;
}

/* =====================================================
   RESPONSIVO
   ===================================================== */

@media (max-width: 1024px) {
    #page-agenda .calendar-sidebar {
        width: 220px;
        min-width: 220px;
    }
}

@media (max-width: 768px) {
    .main-content:has(#page-agenda.active) {
        padding: 12px;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        overflow: hidden;
    }

    #page-agenda {
        height: calc(100vh - 24px);
        height: calc(100dvh - 24px);
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        overflow: hidden !important;
    }

    #page-agenda .calendar-container {
        flex-direction: column;
        max-height: 100%;
        min-height: 0;
        border-radius: 8px;
    }

    #page-agenda .calendar-sidebar {
        width: 100%;
        min-width: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color, #dadce0);
        max-height: 160px;
        flex-shrink: 0;
        overflow: hidden;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 12px;
    }

    #page-agenda .sidebar-header {
        padding: 0;
        width: auto;
    }

    #page-agenda .btn-new-event {
        height: 40px;
        padding-right: 14px;
        font-size: 13px;
        box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3);
    }

    #page-agenda .btn-new-event svg {
        width: 22px;
        height: 22px;
        margin: 9px 6px 9px 10px;
    }

    #page-agenda .calendars-section {
        display: none;
    }

    #page-agenda .google-calendar-wrapper {
        padding: 0;
        border-top: none;
        margin-top: 0;
        margin-left: auto;
    }

    #page-agenda .btn-google-calendar {
        padding: 10px 12px;
        font-size: 12px;
    }

    #page-agenda .google-dropdown {
        bottom: auto;
        top: 100%;
        left: auto;
        right: 0;
        width: 280px;
    }

    #page-agenda .calendar-main {
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    #page-agenda #fullcalendar {
        padding: 0;
        height: 100%;
        min-height: 0;
    }

    #page-agenda .fc .fc-toolbar {
        flex-direction: column;
        gap: 8px;
        padding: 8px 12px;
    }

    #page-agenda .fc .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 4px;
    }

    #page-agenda .fc .fc-toolbar-title {
        font-size: 18px;
    }

    #page-agenda .fc .fc-button {
        padding: 6px 12px;
        font-size: 13px;
    }

    #page-agenda .fc .fc-prev-button,
    #page-agenda .fc .fc-next-button {
        width: 32px;
        height: 32px;
    }

    #event-modal .modal-dialog,
    #calendar-modal .modal-dialog,
    #google-import-modal .modal-dialog {
        max-width: 100%;
        margin: 10px;
    }

    #event-modal .form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* Time Grid responsivo */
@media (max-width: 768px) {
    #page-agenda .fc .fc-timegrid-slot {
        height: 18px;
    }

    #page-agenda .fc .fc-timegrid-axis {
        width: 40px;
        min-width: 40px;
    }

    #page-agenda .fc .fc-timegrid-slot-label {
        font-size: 9px;
    }

    #page-agenda .fc .fc-timegrid-col {
        min-width: 50px;
    }

    #page-agenda .fc .fc-timegrid-event {
        font-size: 9px;
    }

    #page-agenda .fc .fc-timegrid-event .fc-event-main {
        padding: 1px 3px;
    }

    #page-agenda .fc .fc-timegrid-event .fc-event-time {
        font-size: 8px;
    }

    #page-agenda .fc .fc-timegrid-event .fc-event-title {
        font-size: 9px;
    }

    #page-agenda .fc .fc-col-header-cell {
        padding: 6px 0;
    }

    #page-agenda .fc .fc-col-header-cell-cushion {
        font-size: 10px;
    }
}

/* =====================================================
   EVENT POPUP - ESTILO MINIMALISTA
   ===================================================== */

.event-popup {
    position: fixed;
    z-index: 1100;
    background: var(--card, #ffffff);
    border-radius: var(--radius-md, 0.375rem);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border: 1px solid var(--border);
    min-width: 220px;
    max-width: 280px;
    animation: popupFadeIn 0.12s ease-out;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.event-popup-header {
    display: flex;
    justify-content: flex-end;
    padding: 4px 4px 0 4px;
    border-bottom: 1px solid var(--border);
}

.event-popup-actions {
    display: flex;
    gap: 2px;
}

.popup-action-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm, 0.25rem);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground);
    transition: all 0.1s;
}

.popup-action-btn svg {
    width: 14px;
    height: 14px;
}

.popup-action-btn:hover {
    background: var(--accent);
    color: var(--foreground);
}

.popup-action-btn.popup-action-delete:hover {
    background: transparent;
    background-image: linear-gradient(to right, hsl(0 84.2% 60.2%), hsl(0 84.2% 60.2% / 0.6), hsl(0 84.2% 60.2%));
    background-size: 200% auto;
    background-position: 99% center;
    color: white;
    transform: scale(1.1);
}

.event-popup-body {
    padding: 10px 12px 12px 12px;
}

.event-popup-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.event-popup-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.event-popup-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--foreground);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-popup-datetime,
.event-popup-location {
    font-size: 12px;
    color: var(--muted-foreground);
    line-height: 1.4;
}

.event-popup-datetime span::first-letter {
    text-transform: capitalize;
}

.event-popup-location {
    margin-top: 2px;
}

/* Cliente vinculado no popup */
.event-popup-client {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--primary);
    margin-top: 4px;
    padding: 4px 8px;
    background: var(--primary-100, #eff6ff);
    border-radius: var(--radius-sm, 4px);
}

.event-popup-client svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.event-popup-client span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-popup-client-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: var(--radius-sm, 4px);
    color: var(--primary);
    transition: background var(--transition-fast, 150ms);
}

.event-popup-client-link:hover {
    background: var(--primary-200, #dbeafe);
}

/* =====================================================
   SELECT DE CLIENTE ANIMADO NO MODAL
   ===================================================== */

#event-modal .form-group-cliente {
    max-width: 180px;
}

.client-select-animated-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.client-select-animated-wrapper #event-cliente-container {
    flex: 1;
    min-width: 0;
}

.client-select-animated-wrapper .client-profile-link {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 50%;
    color: var(--muted-foreground, #64748b);
    background: var(--background, #fff);
    transition: all 0.15s ease;
}

.client-select-animated-wrapper .client-profile-link:hover {
    background: var(--accent, #f1f5f9);
    color: var(--foreground, #1e293b);
    border-color: var(--ring, #94a3b8);
}

.client-profile-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md, 0.375rem);
    background: var(--primary-100, #eff6ff);
    color: var(--primary);
    transition: all var(--transition-fast, 150ms);
    flex-shrink: 0;
}

.client-profile-link:hover {
    background: var(--primary-200, #dbeafe);
    color: var(--primary-700, #1d4ed8);
}

/* =====================================================
   CLIENTE E VIDEOCHAMADA LADO A LADO
   ===================================================== */

#event-modal .form-row-cliente-meet {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

#event-modal .form-row-cliente-meet .form-group {
    margin-bottom: 0;
}

#event-modal .form-row-cliente-meet .form-group-cliente {
    max-width: none;
}

@media (max-width: 500px) {
    #event-modal .form-row-cliente-meet {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   GOOGLE MEET - VIDEOCHAMADA
   ===================================================== */

#event-modal .form-group-meet {
    margin-bottom: 0;
}

/* Estado vazio - botão para gerar link */
#event-modal .meet-empty {
    display: block;
}

#event-modal .btn-meet-generate {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #1a73e8;
    background: #e8f0fe;
    border: 1px solid #d2e3fc;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

#event-modal .btn-meet-generate:hover {
    background: #d2e3fc;
    border-color: #a8c7fa;
}

#event-modal .btn-meet-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#event-modal .btn-meet-generate svg {
    flex-shrink: 0;
    color: #1a73e8;
}

/* Animação de spin para loading */
#event-modal .btn-meet-generate .animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Estado ativo - com link do Meet */
#event-modal .meet-active {
    display: none;
    position: relative;
}

#event-modal .meet-link-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
    border-radius: 8px;
    gap: 8px;
}

#event-modal .meet-link-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

#event-modal .meet-icon {
    flex-shrink: 0;
}

#event-modal .meet-link {
    font-size: 11px;
    font-weight: 500;
    color: #1e8e3e;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#event-modal .meet-link:hover {
    text-decoration: underline;
    color: #137333;
}

#event-modal .meet-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

#event-modal .btn-meet-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #5f6368;
    cursor: pointer;
    transition: all 0.15s ease;
}

#event-modal .btn-meet-action:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1f1f1f;
}

#event-modal .btn-meet-action.btn-meet-remove:hover {
    background: #fce8e6;
    color: #c5221f;
}

/* Feedback de link copiado */
#event-modal .meet-copied-feedback {
    position: absolute;
    top: -8px;
    right: 12px;
    transform: translateY(-100%);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #fff;
    background: #1e8e3e;
    border-radius: 6px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
}

#event-modal .meet-copied-feedback::after {
    content: '';
    position: absolute;
    bottom: -4px;
    right: 20px;
    width: 8px;
    height: 8px;
    background: #1e8e3e;
    transform: rotate(45deg);
}

#event-modal .meet-copied-feedback.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(-100%) translateY(-4px);
}

/* =====================================================
   INDICADOR DE CLIENTE NO EVENTO DO CALENDÁRIO
   ===================================================== */

/* Evento com cliente - borda sutil indicando vinculação */
.fc-event.has-client {
    box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb, 59, 130, 246), 0.3);
}

.event-client-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    margin-left: 4px;
    opacity: 0.7;
    vertical-align: middle;
}

.event-client-indicator svg {
    width: 10px;
    height: 10px;
}

/* Nos eventos do mini calendário/sidebar */
.day-event-item.has-client::before {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
}

/* Responsivo para o popup */
@media (max-width: 480px) {
    .event-popup {
        min-width: 200px;
        max-width: calc(100vw - 40px);
    }
}

/* Telas muito pequenas */
@media (max-width: 480px) {
    .main-content:has(#page-agenda.active) {
        padding: 8px;
    }

    #page-agenda {
        height: calc(100vh - 16px);
        height: calc(100dvh - 16px);
    }

    #page-agenda .calendar-container {
        border-radius: 8px;
    }

    #page-agenda .calendar-sidebar {
        max-height: 120px;
        padding: 8px;
    }

    #page-agenda .btn-new-event {
        height: 36px;
        padding-right: 12px;
        font-size: 12px;
    }

    #page-agenda .btn-new-event svg {
        width: 18px;
        height: 18px;
        margin: 9px 6px 9px 9px;
    }

    #page-agenda .fc .fc-toolbar-title {
        font-size: 16px;
    }

    #page-agenda .fc .fc-button {
        padding: 4px 8px;
        font-size: 11px;
    }

    #page-agenda .fc .fc-today-button {
        padding: 4px 12px;
    }

    #page-agenda .fc .fc-prev-button,
    #page-agenda .fc .fc-next-button {
        width: 28px;
        height: 28px;
    }

    #page-agenda .fc .fc-timegrid-slot {
        height: 16px;
    }

    #page-agenda .fc .fc-timegrid-axis {
        width: 36px;
        min-width: 36px;
    }

    #page-agenda .fc .fc-daygrid-day-number {
        font-size: 11px;
        padding: 4px;
    }
}

/* =====================================================
   ANIMATED SELECT COMPONENT
   ===================================================== */

.ui-animated-select {
    position: relative;
    width: 100%;
}

/* Trigger (estado fechado) */
.ui-animated-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 8px 3px 3px;
    background: var(--background, #ffffff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ui-animated-select-trigger:hover {
    border-color: var(--ring, #94a3b8);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.ui-animated-select-trigger:focus {
    outline: none;
    border-color: var(--ring, #1f2937);
    box-shadow: 0 0 0 2px var(--background, #fff), 0 0 0 3px var(--ring, #1f2937);
}

.ui-animated-select.open .ui-animated-select-trigger {
    display: none;
}

/* Item dentro do trigger */
.ui-animated-select-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.ui-animated-select-icon {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--muted, #f1f5f9);
    border: 1px solid var(--border, #e2e8f0);
    flex-shrink: 0;
    color: var(--muted-foreground, #64748b);
    font-size: 10px;
    font-weight: 600;
    overflow: hidden;
}

.ui-animated-select-icon svg {
    width: 14px;
    height: 14px;
}

.ui-animated-select-initials {
    font-size: 10px;
    font-weight: 600;
    color: var(--foreground, #1e293b);
}

.ui-animated-select-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.ui-animated-select-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--foreground, #1e293b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ui-animated-select-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground, #64748b);
    padding-left: 4px;
    transition: transform 0.2s ease;
}

.ui-animated-select-chevron svg {
    width: 14px;
    height: 14px;
}

/* Dropdown (estado aberto) */
.ui-animated-select-dropdown {
    background: var(--background, #ffffff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    animation: animatedSelectOpen 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes animatedSelectOpen {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-4px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Header do dropdown */
.ui-animated-select-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border, #e2e8f0);
}

.ui-animated-select-header strong {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--foreground, #1e293b);
}

.ui-animated-select-close {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--muted, #f1f5f9);
    border-radius: 50%;
    cursor: pointer;
    color: var(--muted-foreground, #64748b);
    transition: all 0.15s ease;
}

.ui-animated-select-close:hover {
    background: var(--accent, #e2e8f0);
    color: var(--foreground, #1e293b);
}

/* Lista de opções */
.ui-animated-select-list {
    max-height: 220px;
    overflow-y: auto;
    padding: 4px;
}

.ui-animated-select-list::-webkit-scrollbar {
    width: 4px;
}

.ui-animated-select-list::-webkit-scrollbar-track {
    background: transparent;
}

.ui-animated-select-list::-webkit-scrollbar-thumb {
    background: var(--border, #e2e8f0);
    border-radius: 2px;
}

.ui-animated-select-list::-webkit-scrollbar-thumb:hover {
    background: var(--muted-foreground, #94a3b8);
}

/* Opção individual */
.ui-animated-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    animation: animatedSelectItemIn 0.25s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.ui-animated-select-option:nth-child(1) { animation-delay: 0.02s; }
.ui-animated-select-option:nth-child(2) { animation-delay: 0.04s; }
.ui-animated-select-option:nth-child(3) { animation-delay: 0.06s; }
.ui-animated-select-option:nth-child(4) { animation-delay: 0.08s; }
.ui-animated-select-option:nth-child(5) { animation-delay: 0.10s; }
.ui-animated-select-option:nth-child(6) { animation-delay: 0.12s; }
.ui-animated-select-option:nth-child(7) { animation-delay: 0.14s; }
.ui-animated-select-option:nth-child(8) { animation-delay: 0.16s; }
.ui-animated-select-option:nth-child(n+9) { animation-delay: 0.18s; }

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

.ui-animated-select-option:hover {
    background: var(--accent, #f1f5f9);
}

.ui-animated-select-option.selected {
    background: var(--accent, #f1f5f9);
}

.ui-animated-select-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ui-animated-select-option .ui-animated-select-icon {
    width: 28px;
    height: 28px;
    font-size: 10px;
}

.ui-animated-select-option-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.ui-animated-select-option-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--foreground, #1e293b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ui-animated-select-option-desc {
    font-size: 0.6875rem;
    color: var(--muted-foreground, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.ui-animated-select-check {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary, #1f2937);
    flex-shrink: 0;
}

.ui-animated-select-check svg {
    width: 14px;
    height: 14px;
}

/* Estado vazio */
.ui-animated-select-empty {
    padding: 16px 12px;
    text-align: center;
    color: var(--muted-foreground, #64748b);
    font-size: 0.8125rem;
}

/* Responsivo */
@media (max-width: 480px) {
    .ui-animated-select-dropdown {
        border-radius: 12px;
    }

    .ui-animated-select-header {
        padding: 12px 14px;
    }

    .ui-animated-select-list {
        padding: 6px;
        max-height: 240px;
    }

    .ui-animated-select-option {
        padding: 8px 10px;
        gap: 10px;
    }

    .ui-animated-select-option .ui-animated-select-icon {
        width: 36px;
        height: 36px;
    }
}

/* =========================================================
   GERENCIAMENTO DE TIPOS DE EVENTO
   ========================================================= */

/* Wrapper do select de tipo com botão de gerenciamento */
.tipo-select-wrapper {
    display: flex;
    gap: 6px;
    align-items: center;
}

.tipo-select-wrapper select {
    flex: 1;
}

.btn-manage-tipos {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--card-bg, #fff);
    border-radius: 6px;
    color: var(--muted-foreground, #64748b);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-manage-tipos:hover {
    background: var(--muted, #f1f5f9);
    color: var(--foreground, #0f172a);
    border-color: var(--border-hover, #cbd5e1);
}

/* Modal de tipos - Overlay fixo */
#tipos-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: hsl(0 0% 0% / 0.5);
    z-index: 1100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#tipos-modal.show {
    display: flex;
}

#tipos-modal .modal-dialog {
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

#tipos-modal .modal-content {
    background: var(--card, #fff);
    border-radius: var(--radius-lg, 0.5rem);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    max-height: 100%;
    overflow: hidden;
    border: 1px solid var(--border, #e2e8f0);
}

#tipos-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border, #e2e8f0);
}

#tipos-modal .modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--foreground, #0f172a);
    display: flex;
    align-items: center;
}

#tipos-modal .modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 24px;
    color: var(--muted-foreground, #64748b);
    cursor: pointer;
    transition: all 0.15s ease;
}

#tipos-modal .modal-close:hover {
    background: var(--muted, #f1f5f9);
    color: var(--foreground, #0f172a);
}

#tipos-modal .modal-body {
    padding: 0;
    overflow: auto;
}

/* Container do modal de tipos */
.tipos-container {
    display: grid;
    grid-template-columns: 1fr 280px;
    min-height: 400px;
}

/* Lista de tipos */
.tipos-list {
    padding: 16px;
    border-right: 1px solid var(--border-color, #e2e8f0);
    overflow-y: auto;
    max-height: 500px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Item de tipo */
.tipo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--muted, #f8fafc);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.tipo-item:hover {
    background: var(--accent, #f1f5f9);
}

.tipo-item-inactive {
    opacity: 0.5;
}

.tipo-item-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg, #fff);
    border-radius: 8px;
    border: 1px solid var(--border-color, #e2e8f0);
}

.tipo-item-icon svg {
    width: 20px;
    height: 20px;
}

.tipo-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.tipo-item-nome {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--foreground, #0f172a);
}

.tipo-item-slug {
    font-size: 0.75rem;
    color: var(--muted-foreground, #64748b);
    font-family: monospace;
}

.tipo-item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tipo-badge-sistema {
    font-size: 0.625rem;
    padding: 2px 6px;
    background: var(--primary, #4285f4);
    color: white;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.btn-tipo-edit,
.btn-tipo-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: var(--muted-foreground, #64748b);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-tipo-edit:hover {
    background: var(--primary, #4285f4);
    color: white;
}

.btn-tipo-delete:hover {
    background: var(--destructive, #ef4444);
    color: white;
}

.btn-tipo-delete.btn-disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.btn-tipo-delete.btn-disabled:hover {
    background: transparent;
    color: var(--muted-foreground, #64748b);
}

/* Botão adicionar tipo */
.btn-add-tipo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    margin-top: 8px;
    border: 2px dashed var(--border-color, #e2e8f0);
    background: transparent;
    border-radius: 8px;
    color: var(--muted-foreground, #64748b);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-tipo:hover {
    border-color: var(--primary, #4285f4);
    color: var(--primary, #4285f4);
    background: rgba(66, 133, 244, 0.05);
}

/* Formulário de tipo */
.tipo-form {
    padding: 16px;
    background: var(--muted, #f8fafc);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tipo-form h6 {
    margin: 0 0 8px 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--foreground, #0f172a);
}

/* Color picker do tipo */
.tipo-color-picker {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tipo-color-picker input[type="color"] {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    background: none;
}

.tipo-color-picker input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.tipo-color-picker input[type="color"]::-webkit-color-swatch {
    border: 2px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
}

.tipo-cor-preview {
    font-family: monospace;
    font-size: 0.8125rem;
    color: var(--muted-foreground, #64748b);
}

/* Seletor de ícone */
.tipo-icon-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tipo-icon-preview {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg, #fff);
    border: 2px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    color: var(--primary, #4285f4);
}

.tipo-icon-preview svg {
    width: 24px;
    height: 24px;
}

.tipo-icon-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.tipo-icon-option {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--card-bg, #fff);
    border-radius: 6px;
    color: var(--muted-foreground, #64748b);
    cursor: pointer;
    transition: all 0.15s ease;
}

.tipo-icon-option:hover {
    border-color: var(--primary, #4285f4);
    color: var(--primary, #4285f4);
    background: rgba(66, 133, 244, 0.05);
}

.tipo-icon-option.selected {
    border-color: var(--primary, #4285f4);
    background: var(--primary, #4285f4);
    color: white;
}

.tipo-icon-option svg {
    width: 16px;
    height: 16px;
}

/* Ações do formulário */
.tipo-form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-color, #e2e8f0);
}

#btn-tipo-cancel {
    display: none;
}

/* Responsivo */
@media (max-width: 640px) {
    .tipos-container {
        grid-template-columns: 1fr;
    }

    .tipos-list {
        border-right: none;
        border-bottom: 1px solid var(--border-color, #e2e8f0);
        max-height: 250px;
    }

    .tipo-icon-grid {
        grid-template-columns: repeat(7, 1fr);
    }
}
