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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f8f9fa;
    color: #2c3e50;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, #4a90e2 0%, #00d4aa 100%);
    color: white;
    padding: 30px;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(74, 144, 226, 0.15);
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 5px;
}

.header p {
    opacity: 0.9;
    font-size: 14px;
}

/* Main Grid */
.main-grid {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 24px;
}

/* Calendar Section */
.calendar-section {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

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

.calendar-header h2 {
    font-size: 18px;
    color: #2c3e50;
}

.calendar-nav {
    display: flex;
    gap: 8px;
}

.calendar-nav button {
    background: #f8f9fa;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    color: #4a90e2;
    font-weight: bold;
    transition: all 0.2s;
}

.calendar-nav button:hover {
    background: #e9ecef;
}

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

.calendar-day-label {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #6c757d;
    padding: 8px 0;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: #f8f9fa;
    position: relative;
}

.calendar-day:hover {
    background: #e9ecef;
}

.calendar-day.other-month {
    opacity: 0.3;
}

.calendar-day.today {
    background: linear-gradient(135deg, #4a90e2 0%, #00d4aa 100%);
    color: white;
    font-weight: bold;
}

.calendar-day.selected {
    background: #4a90e2;
    color: white;
    font-weight: bold;
}

.calendar-day.has-appointments {
    background: #e7f5f0;
}

.calendar-day.has-appointments.selected {
    background: #4a90e2;
    color: white;
}

.appointment-badge {
    position: absolute;
    bottom: 4px;
    background: #00d4aa;
    color: white;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.calendar-day.selected .appointment-badge {
    background: white;
    color: #4a90e2;
}

/* Schedule Section */
.schedule-section {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.schedule-header h2 {
    font-size: 18px;
    color: #2c3e50;
}

.btn-new {
    background: linear-gradient(135deg, #00d4aa 0%, #4a90e2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0, 212, 170, 0.2);
}

.btn-new:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 212, 170, 0.3);
}

.appointments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.appointment-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    border-left: 4px solid #4a90e2;
}

.appointment-card:hover {
    background: #e9ecef;
    transform: translateX(4px);
}

.appointment-info {
    flex: 1;
}

.appointment-time {
    font-size: 16px;
    font-weight: 600;
    color: #4a90e2;
    margin-bottom: 4px;
}

.appointment-patient {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 500;
}

.appointment-status {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
}

.appointment-actions {
    display: flex;
    gap: 8px;
}

.btn-action {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-view {
    background: #e7f3ff;
    color: #4a90e2;
}

.btn-view:hover {
    background: #d0e7ff;
}

.btn-cancel {
    background: #ffe7e7;
    color: #e74c3c;
}

.btn-cancel:hover {
    background: #ffd0d0;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 22px;
    color: #2c3e50;
}

.btn-close {
    background: #f8f9fa;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    color: #6c757d;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4a90e2;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.autocomplete-wrapper {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.autocomplete-list.active {
    display: block;
}

.autocomplete-item {
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.autocomplete-item:hover {
    background: #f8f9fa;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn-submit {
    flex: 1;
    background: linear-gradient(135deg, #00d4aa 0%, #4a90e2 100%);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 212, 170, 0.3);
}

.btn-cancel-form {
    flex: 1;
    background: #f8f9fa;
    color: #6c757d;
    border: none;
    padding: 14px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel-form:hover {
    background: #e9ecef;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

/* Modal Detalhes Paciente */
.modal-details {
    max-width: 800px;
}

.details-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid #e9ecef;
}

.tab-button {
    background: transparent;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    color: #6c757d;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.tab-button:hover {
    color: #4a90e2;
}

.tab-button.active {
    color: #4a90e2;
    border-bottom-color: #4a90e2;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.info-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
}

.info-label {
    font-size: 12px;
    color: #6c757d;
    font-weight: 600;
    margin-bottom: 4px;
}

.info-value {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 500;
}

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

.info-section h3 {
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e9ecef;
}

.history-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 3px solid #4a90e2;
}

.history-date {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 4px;
}

.history-text {
    font-size: 14px;
    color: #2c3e50;
}

.financial-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.financial-card {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.financial-label {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 4px;
}

.financial-value {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
}

.financial-value.positive {
    color: #00d4aa;
}

.financial-value.negative {
    color: #e74c3c;
}

/* Responsive */
@media (max-width: 968px) {
    .main-grid {
        grid-template-columns: 1fr;
    }

    .calendar-section {
        order: 2;
    }

    .schedule-section {
        order: 1;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .financial-summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 22px;
    }

    .calendar-day {
        font-size: 14px;
    }

    .appointment-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .appointment-actions {
        margin-top: 12px;
        width: 100%;
        justify-content: flex-end;
    }
}
