/**
 * OdontoSystem - Sistema de Gestão para Clínicas Odontológicas
 * Folha de Estilos Principal
 * 
 * Organização:
 * 1. Estilos Globais
 * 2. Componentes
 * 3. Páginas
 * 4. Animações
 * 5. Responsividade
 */

/* ============================================
   1. ESTILOS GLOBAIS
   ============================================ */

body {
    font-family: 'Poppins', sans-serif;
    background-color: #f0f9ff;
}

/* ============================================
   2. COMPONENTES
   ============================================ */

/* Login Container */
.login-container {
    background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);
}

/* Botões Primários */
.btn-primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);
    transition: all 0.3s ease;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #0284c7 0%, #075985 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(3, 105, 161, 0.3);
}

.btn-primary:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

/* Botões Secundários */
.btn-secondary {
    background-color: #64748b;
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

/* Cards */
.card {
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 
                0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Navegação */
.nav-item {
    transition: all 0.2s ease;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.active-nav {
    background-color: rgba(255, 255, 255, 0.2);
    border-left: 4px solid white;
}

/* Tabelas */
.table-row:hover {
    background-color: #e0f2fe;
}

/* ============================================
   3. COMPONENTES ESPECÍFICOS
   ============================================ */

/* Paciente Chamado (Fila) */
.called-patient-card {
    animation: pulse 2s infinite;
}

/* Imagens do Prontuário */
.prontuario-image {
    position: relative;
}

.prontuario-image .delete-img-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(239, 68, 68, 0.8);
    border-radius: 9999px;
    display: none;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.prontuario-image:hover .delete-img-btn {
    display: flex;
}

/* Texto Formatado (Prose) */
.prose ul {
    list-style-type: disc;
    margin-left: 20px;
}

.prose strong {
    font-weight: 600;
}

/* Abas (Tabs) */
.tab {
    padding: 8px 16px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab:hover {
    background-color: rgba(14, 165, 233, 0.1);
}

.tab.active {
    border-color: #0ea5e9;
    color: #0ea5e9;
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Sidebar */
#main-sidebar {
    transition: transform 0.3s ease-in-out;
}

#main-sidebar.sidebar-open {
    transform: translateX(0);
}

/* Overlay do Sidebar Mobile */
#sidebar-overlay {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

/* ============================================
   4. ANIMAÇÕES
   ============================================ */

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7);
    }
    70% {
        transform: scale(1.02);
        box-shadow: 0 0 10px 20px rgba(22, 163, 74, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0);
    }
}

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide In */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* ============================================
   5. IMPRESSÃO
   ============================================ */

@media print {
    body * {
        visibility: hidden;
    }
    
    #print-area,
    #print-area * {
        visibility: visible;
    }
    
    #print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
}

/* ============================================
   6. RESPONSIVIDADE
   ============================================ */

/* Tablets e menores */
@media (max-width: 768px) {
    .card {
        transform: none;
    }
    
    .card:hover {
        transform: none;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }
}

/* Smartphones */
@media (max-width: 640px) {
    .tab {
        padding: 6px 12px;
        font-size: 0.875rem;
    }
}

/* ============================================
   7. ESTADOS E UTILIDADES
   ============================================ */

/* Loading */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Disabled */
.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Hidden com transição */
.fade-out {
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.fade-in {
    opacity: 1;
    transition: opacity 0.3s ease-in;
}

/* Scroll suave customizado */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ============================================
   8. TOAST NOTIFICATIONS
   ============================================ */

#toast {
    transition: all 0.3s ease;
}

#toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   9. MODAIS
   ============================================ */

#modal-overlay {
    backdrop-filter: blur(2px);
    transition: opacity 0.3s ease;
}

#modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   10. CORES CUSTOMIZADAS (Fila)
   ============================================ */

/* Fila Particular */
.queue-particular-bg {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

/* Fila Convênio */
.queue-convenio-bg {
    background: linear-gradient(135deg, #9333ea 0%, #7c3aed 100%);
}

/* ============================================
   11. PÁGINA DE PACIENTES
   ============================================ */

/* Controle de visibilidade de páginas */
.page-content {
    display: block;
}

.page-content.hidden {
    display: none;
}

/* Tabela de Pacientes */
.patients-table tbody tr {
    transition: background-color 0.2s ease;
}

.patients-table tbody tr:hover {
    background-color: #f8fafc;
}

/* Abas do Prontuário */
.tab-btn {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    color: #6b7280;
    font-weight: 500;
}

.tab-btn:hover {
    color: #2563eb;
    background-color: rgba(37, 99, 235, 0.05);
}

.tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    background-color: rgba(37, 99, 235, 0.05);
}

/* Modal de Paciente */
#patient-modal .modal-content {
    animation: slideInDown 0.3s ease;
}

#record-modal .modal-content {
    animation: slideInDown 0.3s ease;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cards de Evolução e Orçamentos */
.evolution-card,
.budget-card {
    transition: all 0.2s ease;
}

.evolution-card:hover,
.budget-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

/* Status dos Orçamentos */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-pendente {
    background-color: #fef3c7;
    color: #92400e;
}

.status-aprovado {
    background-color: #d1fae5;
    color: #065f46;
}

.status-rejeitado {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Input de Busca com ícone */
.search-input-wrapper {
    position: relative;
}

.search-input-wrapper input {
    padding-left: 2.5rem;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

/* Animação de Loading para tabela */
.table-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

.spinner {
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Destaque de campo obrigatório */
label.required::after {
    content: " *";
    color: #ef4444;
}

/* Validação de inputs */
input.invalid,
textarea.invalid {
    border-color: #ef4444 !important;
    background-color: #fef2f2;
}

input.valid,
textarea.valid {
    border-color: #10b981 !important;
    background-color: #f0fdf4;
}

/* Tooltip customizado */
.tooltip {
    position: relative;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background-color: #1f2937;
    color: white;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.tooltip:hover::before {
    opacity: 1;
}

/* Responsividade para página de pacientes */
@media (max-width: 768px) {
    .tab-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    #patient-modal .modal-content,
    #record-modal .modal-content {
        max-height: 85vh;
    }
}

