/* Google Calendar Style - Layout Exato */

.calendar-wrapper {
    background: #1a1a1a;
    min-height: 100vh;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Header do Google Calendar */
.google-calendar-header {
    background: #2d2d30;
    border-bottom: 1px solid #3c3c3c;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #e8eaed;
    font-size: 22px;
    font-weight: 400;
}

.header-logo i {
    color: var(--primary-orange);
    font-size: 24px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.today-btn {
    background: transparent;
    border: 1px solid #5f6368;
    color: #e8eaed;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    white-space: nowrap;
}

.today-btn:hover {
    background: #3c4043;
    border-color: #8ab4f8;
    color: #e8eaed;
    text-decoration: none;
}

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

.nav-btn {
    background: transparent;
    border: none;
    color: #e8eaed;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s;
}

.nav-btn:hover {
    background: #3c4043;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    flex: 1;
}

.calendar-title {
    color: #e8eaed;
    font-size: 22px;
    font-weight: 400;
    margin: 0;
    min-width: 200px;
    text-align: center;
    white-space: nowrap;
}

.current-month-display {
    color: #e8eaed;
    font-size: 22px;
    font-weight: 400;
    margin: 0 16px;
    min-width: 200px;
    text-align: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.view-selector {
    display: flex;
    background: #3c4043;
    border-radius: 4px;
    padding: 2px;
}

.view-option {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: #e8eaed;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.view-option:hover {
    background: #48494a;
    color: #e8eaed;
}

.view-option.active {
    background: var(--primary-orange);
    color: white;
}

/* Layout Principal */
.calendar-container {
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: 700px;
    width: 100%;
    margin-bottom: 60px;
    overflow: hidden;
}

/* Sidebar do Google Calendar */
.calendar-sidebar {
    width: 256px;
    background: #2d2d30;
    border-right: 1px solid #3c3c3c;
    padding: 24px 16px;
    overflow-y: auto;
}

.create-btn {
    background: var(--primary-orange);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
    transition: all 0.2s;
}

.create-btn:hover {
    background: #ff6f00;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
}

.mini-calendar-container {
    margin-bottom: 32px;
}

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

.mini-month-nav {
    background: transparent;
    border: none;
    color: #e8eaed;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.mini-month-nav:hover {
    background: #3c4043;
}

.mini-month-title {
    color: #e8eaed;
    font-size: 14px;
    font-weight: 500;
}

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

.mini-day-header {
    color: #9aa0a6;
    font-size: 11px;
    text-align: center;
    padding: 4px;
    font-weight: 500;
}

.mini-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #e8eaed;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.mini-day:hover:not(.empty) {
    background: #3c4043;
}

.mini-day.today {
    background: var(--primary-orange);
    color: white;
    font-weight: 600;
}

.mini-day.has-events {
    color: var(--primary-orange);
    font-weight: 600;
}

.mini-day.empty {
    color: #5f6368;
}

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section h3 {
    color: #e8eaed;
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 12px 0;
}

.calendar-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.calendar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    color: #e8eaed;
    font-size: 14px;
}

.calendar-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Grid Principal do Calendário */
.calendar-main {
    flex: 1;
    background: #1a1a1a;
    overflow: hidden;
}

.calendar-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.calendar-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 500px;
}

.weekdays-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #2d2d30;
    border-bottom: 1px solid #3c3c3c;
    width: 100%;
}

.weekday {
    padding: 16px 8px;
    text-align: center;
    color: #9aa0a6;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-right: 1px solid #3c3c3c;
}

.weekday:last-child {
    border-right: none;
}

.days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 100px);
    background: #1a1a1a;
    width: 100%;
    height: 600px;
}

.calendar-day {
    border-right: 1px solid #3c3c3c;
    border-bottom: 1px solid #3c3c3c;
    height: 100px;
    background: #1a1a1a;
    position: relative;
    transition: background 0.2s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.calendar-day:nth-child(7n) {
    border-right: none;
}

.calendar-day:hover:not(.other-month) {
    background: #252525;
}

.day-number {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #e8eaed;
    border-radius: 50%;
    font-weight: 400;
}

.calendar-day.today .day-number {
    background: var(--primary-orange);
    color: white;
    font-weight: 600;
}

.calendar-day.other-month {
    background: #1a1a1a;
}

.calendar-day.other-month .day-number {
    color: #5f6368;
}

.day-events {
    margin-top: 36px;
    padding: 0 4px 4px 4px;
    max-height: calc(100% - 36px);
    overflow-y: auto;
}

.calendar-event {
    background: var(--primary-orange);
    border-radius: 2px;
    padding: 2px 6px;
    margin-bottom: 2px;
    font-size: 11px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-event:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.event-time {
    font-weight: 600;
    margin-right: 4px;
}

.more-events {
    color: #9aa0a6;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 2px;
    transition: background 0.2s;
}

.more-events:hover {
    background: #3c4043;
    color: #e8eaed;
}

/* Responsividade */
@media (max-width: 1024px) {
    .calendar-sidebar {
        width: 200px;
    }
    
    .current-month-display {
        font-size: 18px;
        min-width: 150px;
    }
    
    .weekdays-header th {
        padding: 0.8rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .calendar-week {
        height: 110px;
    }
    
    .calendar-day {
        height: 110px;
    }
}

@media (max-width: 768px) {
    .calendar-container {
        flex-direction: column;
        max-height: 500px;
        margin-bottom: 80px;
    }
    
    .calendar-nav {
        gap: 8px;
    }
    
    .calendar-title {
        font-size: 18px;
        min-width: 120px;
    }
    
    .today-btn {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .today-btn i {
        display: none; /* Esconde o ícone em telas pequenas */
    }
    
    .days-grid {
        height: 400px;
    }
    
    .calendar-sidebar {
        width: 100%;
        height: auto;
        padding: 16px;
        border-right: none;
        border-bottom: 1px solid #3c3c3c;
    }
    
    .mini-calendar-container {
        display: none;
    }
    
    .header-left {
        gap: 16px;
    }
    
    .header-logo {
        font-size: 18px;
    }
    
    .current-month-display {
        font-size: 16px;
        min-width: 120px;
    }
    
    .weekdays-header th {
        padding: 0.5rem 0.25rem;
        font-size: 0.7rem;
    }
    
    .calendar-week {
        height: 80px;
    }
    
    .calendar-day {
        height: 80px;
        padding: 0.25rem;
    }
    
    .day-number {
        font-size: 0.8rem;
        padding: 0.2rem 0.4rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 1rem;
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 480px) {
    .google-calendar-header {
        padding: 0 12px;
        height: 56px;
    }
    
    .header-controls {
        gap: 8px;
    }
    
    .view-selector {
        display: none;
    }
    
    .weekdays-header th {
        padding: 0.3rem 0.1rem;
        font-size: 0.6rem;
    }
    
    .calendar-week {
        height: 60px;
    }
    
    .calendar-day {
        height: 60px;
        padding: 0.1rem;
    }
    
    .day-number {
        font-size: 0.7rem;
        padding: 0.1rem 0.3rem;
    }
    
    .day-events {
        height: calc(100% - 20px);
        gap: 1px;
    }
    
    .calendar-event {
        padding: 0.1rem 0.3rem;
        margin-bottom: 1px;
        font-size: 0.65rem;
    }
    
    .event-title {
        font-size: 0.6rem;
    }
    
    .event-time {
        font-size: 0.55rem;
    }
    
    .more-events {
        font-size: 0.55rem;
        padding: 0.1rem;
    }
}

/* Estrutura de Tabela do Calendário */
.calendar-content {
    padding: 0;
}

.calendar-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--dark-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.weekdays-header th {
    background: var(--dark-bg);
    padding: 1rem;
    text-align: center;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.9rem;
    text-transform: uppercase;
}

.weekdays-header th:last-child {
    border-right: none;
}

.calendar-week {
    height: 120px;
}

.calendar-day {
    height: 120px;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem;
    background: var(--dark-card);
    vertical-align: top;
    position: relative;
    transition: background 0.3s ease;
}

.calendar-day:hover:not(.other-month) {
    background: var(--dark-bg);
}

.calendar-day:last-child {
    border-right: none;
}

.calendar-week:last-child .calendar-day {
    border-bottom: none;
}

.other-month {
    background: var(--dark-bg);
    opacity: 0.3;
}

.today {
    background: #2a2a2a;
    box-shadow: inset 0 0 0 2px var(--primary-orange);
}

.day-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 0.5rem;
}

.day-number {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.today .day-number {
    background: var(--primary-orange);
    color: white;
    font-weight: bold;
}

.day-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    height: calc(100% - 30px);
}

/* Eventos na Tabela */
.calendar-event {
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 2px;
    background-color: rgba(255,255,255,0.1) !important;
    border-left: 3px solid;
    font-size: 0.75rem;
}

.calendar-event:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    background-color: rgba(255,255,255,0.2) !important;
}

.event-content {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.event-time {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-light);
    opacity: 0.9;
}

.event-title {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
    line-height: 1.2;
    word-break: break-word;
}

.more-events {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0.2rem;
    cursor: pointer;
    border-radius: 3px;
    transition: color 0.3s ease;
    margin-top: 2px;
}

.more-events:hover {
    color: var(--primary-orange);
    background: rgba(255,255,255,0.05);
}

.empty-day {
    height: 100%;
}

/* Modal de Evento - Bootstrap Override */
.modal {
    z-index: 1055 !important;
}

.modal-backdrop {
    z-index: 1050 !important;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-dialog {
    margin: 1.75rem auto;
}

.modal-content {
    background: var(--dark-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.modal-header {
    background: var(--dark-bg);
    border-bottom: 1px solid var(--border-color);
    border-radius: 12px 12px 0 0;
    padding: 1.5rem;
}

.modal-title {
    color: var(--text-light);
    font-family: var(--font-title);
    font-size: 1.25rem;
    margin: 0;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    opacity: 1;
    filter: none;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.btn-close:hover {
    background: var(--border-color);
    color: var(--text-light);
    opacity: 1;
}

.btn-close::before {
    content: "×";
    font-size: 1.5rem;
    line-height: 1;
}

.modal-body {
    padding: 1.5rem;
    color: var(--text-light);
}

.event-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-light);
}

.info-row i {
    width: 20px;
    color: var(--primary-orange);
    font-size: 1rem;
}

.event-description {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.event-description h6 {
    margin: 0 0 0.5rem 0;
    color: var(--text-light);
    font-size: 1rem;
}

.event-description p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.5;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 12px 12px;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.modal-footer .btn {
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.modal-footer .btn-primary {
    background: var(--primary-orange);
    border-color: var(--primary-orange);
    color: white;
}

.modal-footer .btn-primary:hover {
    background: #e55a00;
    border-color: #e55a00;
    transform: translateY(-1px);
}

.modal-footer .btn-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.modal-footer .btn-secondary:hover {
    background: var(--border-color);
    color: var(--text-light);
    border-color: var(--border-color);
}

/* Garantir que eventos sejam clicáveis */
.calendar-event {
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.calendar-event:hover {
    transform: translateX(2px) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
    background-color: rgba(255,255,255,0.2) !important;
}

/* Responsividade para modais Bootstrap */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .modal-footer .btn:last-child {
        margin-bottom: 0;
    }
}

/* Fix específico para evitar sobreposição do rodapé */
.calendar-container {
    contain: layout style !important;
    isolation: isolate !important;
}

/* Garantir espaçamento adequado no main */
main {
    min-height: calc(100vh - 200px) !important;
    padding-bottom: 80px !important;
}

/* Força altura máxima em todas as resoluções */
@media (min-width: 1200px) {
    .calendar-container {
        max-height: 650px !important;
    }
}

@media (max-width: 1199px) {
    .calendar-container {
        max-height: 550px !important;
    }
}