/* ========================================
   RESET E VARIÁVEIS
   ======================================== */

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

:root {
    --primary-color: #4285F4;
    --secondary-color: #34A853;
    --danger-color: #EA4335;
    --warning-color: #FBBC04;
    --text-dark: #202124;
    --text-light: #5F6368;
    --bg-light: #F8F9FA;
    --bg-white: #FFFFFF;
    --border-color: #DADCE0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.16);
}

/* ========================================
   TIPOGRAFIA E BASE
   ======================================== */

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    font-weight: 400;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 500;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1rem;
}

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

a:hover {
    color: #1f71e8;
    text-decoration: underline;
}

/* ========================================
   HEADER
   ======================================== */

header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1f71e8 100%);
    color: white;
    padding: 2rem 1rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
}

.header-content h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: white;
}

.header-content p {
    font-size: 1rem;
    opacity: 0.95;
    margin-bottom: 0;
}

/* ========================================
   CONTAINER
   ======================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ========================================
   CONTROLES
   ======================================== */

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.month-navigation {
    display: flex;
    gap: 1rem;
    align-items: center;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

button:hover {
    background-color: #1f71e8;
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

button.secondary {
    background-color: var(--bg-white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

button.secondary:hover {
    background-color: var(--bg-light);
}

.current-month {
    font-size: 1.25rem;
    font-weight: 500;
    min-width: 200px;
    text-align: center;
}

/* ========================================
   CALENDÁRIO
   ======================================== */

.calendar {
    background: var(--bg-white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.calendar-header {
    background-color: var(--primary-color);
    color: white;
    padding: 1.5rem;
    text-align: center;
}

.calendar-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background-color: var(--bg-light);
    border-bottom: 2px solid var(--border-color);
}

.weekday {
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    min-height: 500px;
}

.day {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    min-height: 120px;
    background-color: var(--bg-white);
    transition: background-color 0.2s ease;
    position: relative;
    overflow-y: auto;
}

.day:hover {
    background-color: var(--bg-light);
}

.day.other-month {
    background-color: #FAFAFA;
    color: var(--text-light);
}

.day.today {
    background-color: #E8F0FE;
    border-left: 4px solid var(--primary-color);
}

.day-number {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.day.other-month .day-number {
    color: var(--text-light);
}

/* ========================================
   EVENTOS
   ======================================== */

.events {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.event {
    background-color: var(--primary-color);
    color: white;
    padding: 0.4rem 0.6rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid rgba(0, 0, 0, 0.2);
}

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

.event.work {
    background-color: #FF6B6B;
}

.event.personal {
    background-color: #4ECDC4;
}

.event.birthday {
    background-color: #FFE66D;
    color: var(--text-dark);
}

.event.holiday {
    background-color: #95E1D3;
    color: var(--text-dark);
}

.event.meeting {
    background-color: #6C5CE7;
}

.event-time {
    font-size: 0.65rem;
    opacity: 0.9;
    display: block;
    margin-top: 0.2rem;
}

/* ========================================
   MODAL
   ======================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: var(--bg-white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
}

.modal-header h2 {
    margin: 0;
    color: var(--text-dark);
}

.modal-body {
    margin-bottom: 1.5rem;
}

.event-detail {
    margin-bottom: 1rem;
}

.event-detail-label {
    font-weight: 600;
    color: var(--text-dark);
    display: block;
    margin-bottom: 0.25rem;
}

.event-detail-value {
    color: var(--text-light);
    padding-left: 1rem;
}

.modal-footer {
    text-align: right;
}

.close-btn {
    background-color: var(--border-color);
    color: var(--text-dark);
    padding: 0.75rem 1.5rem;
}

.close-btn:hover {
    background-color: #D3D3D3;
}

/* ========================================
   MENSAGENS
   ======================================== */

.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-error {
    background-color: #FFEBEE;
    color: #C62828;
    border-color: #EA4335;
}

.alert-warning {
    background-color: #FFF3E0;
    color: #E65100;
    border-color: #FBBC04;
}

.alert-success {
    background-color: #E8F5E9;
    color: #2E7D32;
    border-color: #34A853;
}

.alert-info {
    background-color: #E3F2FD;
    color: #1565C0;
    border-color: #4285F4;
}

/* ========================================
   CARREGAMENTO
   ======================================== */

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   FOOTER
   ======================================== */

footer {
    background-color: var(--text-dark);
    color: white;
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 3rem;
}

footer p {
    margin-bottom: 0.5rem;
}

footer a {
    color: var(--primary-color);
}

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

@media (max-width: 768px) {
    h1 {
        font-size: 1.5rem;
    }

    .header-content h1 {
        font-size: 1.75rem;
    }

    .weekdays {
        font-size: 0.8rem;
    }

    .day {
        min-height: 80px;
        padding: 0.5rem;
    }

    .day-number {
        font-size: 0.9rem;
    }

    .event {
        font-size: 0.65rem;
        padding: 0.3rem 0.5rem;
    }

    .modal-content {
        width: 95%;
    }
}

@media (max-width: 480px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .month-navigation {
        width: 100%;
        justify-content: space-between;
    }

    .current-month {
        min-width: unset;
    }

    button {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* ========================================
   ADICIONAIS (Para Day View)
   ======================================== */

.day-view {
    padding: 1rem;
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.day-view h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.day-events-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.event-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-left: 5px solid var(--primary-color);
    background-color: var(--bg-light);
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    cursor: pointer;
}

.event-time-col {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    min-width: 70px;
    text-align: center;
    padding-right: 1rem;
    border-right: 1px solid var(--border-color);
}

.event-details-col {
    padding-left: 1rem;
    flex-grow: 1;
}

.event-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-dark);
    display: block;
}

.event-description-short {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.2rem;
    margin-bottom: 0;
}

/* Cores dos itens na Day-View */
.event-item.work {
    border-left-color: #FF6B6B;
}
.event-item.personal {
    border-left-color: #4ECDC4;
}
.event-item.birthday {
    border-left-color: #FFE66D;
}
.event-item.holiday {
    border-left-color: #95E1D3;
}
.event-item.meeting {
    border-left-color: #6C5CE7;
}

/* ========================================
   VIEW TOGGLE (Para Day/Week/Month)
   ======================================== */

.view-toggle {
    display: flex;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    overflow: hidden;
}

.view-toggle button {
    background-color: transparent;
    color: var(--primary-color);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: none;
}

.view-toggle button.active {
    background-color: var(--primary-color);
    color: var(--bg-white);
    box-shadow: none;
}

.view-toggle button:hover:not(.active) {
    background-color: #E8F0FE;
}

