/* MedicAI - Sistema Médico v3 - Estilos Principais */

/* Design System - Variáveis CSS - Gradiente azul meio termo metálico */
:root {
    --primary-gradient: linear-gradient(135deg, #1e40af 0%, #2563eb 30%, #3b82f6 60%, #2563eb 100%);
    --primary-color: #2563eb;
    --secondary-color: #3b82f6;
    --accent-color: #6366f1;
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --error-color: #EF4444;
    --info-color: #2563eb;

    --clinic-color: #3b82f6;
    --patient-color: #2563eb;
    --consultation-color: #6366f1;

    --sidebar-width: 280px;
    --header-height: 64px;
}

/* ========================================
   OTIMIZAÇÕES DE PERFORMANCE
   ======================================== */
html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Layout Principal */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--primary-gradient);
    border-right: 2px solid rgba(59, 130, 246, 0.7);
    box-shadow:
        3px 0 10px rgba(0, 0, 0, 0.12),
        3px 0 6px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(59, 130, 246, 0.25),
        6px 0 25px rgba(37, 99, 235, 0.3);
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 1000;
}

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.content-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid #E5E7EB;
    position: sticky;
    top: 0;
    z-index: 50;
}

/* Menu Items */
.menu-item {
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 4px 12px;
    position: relative;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateX(3px);
}

.menu-item.active {
    background: rgba(255, 255, 255, 0.18);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: white;
    border-radius: 0 2px 2px 0;
}

/* Cards e Componentes */
.stat-card {
    background: var(--primary-gradient);
    color: white;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.25);
}

.interactive-card {
    transition: all 0.3s ease;
    cursor: pointer;
    border-radius: 16px;
}

.interactive-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Bordas Coloridas */
.clinic-card {
    border-left: 2px solid rgba(59, 130, 246, 0.3);
}

.patient-card {
    border-left: 2px solid rgba(37, 99, 235, 0.3);
}


/* Animações */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(30px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.show {
    display: flex !important;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    z-index: 9999;
    max-height: 90vh;
    overflow-y: auto;
    width: 100%;
    max-width: 500px;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: between;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    flex: 1;
}

.modal-close {
    background: none;
    border: none;
    color: #6B7280;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: #374151;
    background-color: #F3F4F6;
}

.modal-body {
    padding: 1.5rem;
}

/* Breadcrumb */
.breadcrumb-item {
    color: #6B7280;
    transition: color 0.2s ease;
    cursor: pointer;
}

.breadcrumb-item:hover {
    color: var(--primary-color);
}

.breadcrumb-item.active {
    color: #111827;
    font-weight: 600;
}

/* Logo */
.logo-container img {
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15));
}

/* Botões */
.btn-primary {
    background: var(--primary-gradient);
    color: white;
    transition: all 0.3s ease;
    border-radius: 12px;
    padding: 0.5rem 1rem;
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-success {
    background: var(--success-color);
    color: white;
    transition: all 0.3s ease;
    border-radius: 12px;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
    background: #F3F4F6;
    color: #374151;
    border: 1px solid #D1D5DB;
    transition: all 0.3s ease;
    border-radius: 12px;
    padding: 0.5rem 1rem;
}

.btn-secondary:hover {
    background: #E5E7EB;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 1.5rem;
    border-top: 1px solid #E5E7EB;
}

/* Loading Spinner */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e0e7ff;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Animação da barra de progresso */
@keyframes loading-bar {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.animate-loading-bar {
    animation: loading-bar 1.5s ease-in-out infinite;
}

/* Estilos EXATOS copiados do frontend original */

/* Animações */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(30px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Cards e Componentes */
.stat-card {
    background: var(--primary-gradient);
    color: white;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.25);
}

.interactive-card {
    transition: all 0.3s ease;
    cursor: pointer;
    border-radius: 16px;
}

.interactive-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Bordas Coloridas */
.clinic-card {
    border-left: 2px solid rgba(59, 130, 246, 0.3);
}

.patient-card {
    border-left: 2px solid rgba(37, 99, 235, 0.3);
}

/* Responsivo */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    /* Grid responsivo para clínicas */
    #clinicas-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    #clinicas-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ========================================
   TELA DE CONSULTA - RESPONSIVIDADE
   ======================================== */

/* Tela de consulta sempre acima, mas respeitando sidebar em desktop */
#tela-consulta {
    z-index: 10000 !important;
    left: var(--sidebar-width) !important;
    width: calc(100% - var(--sidebar-width)) !important;
}

/* Tablet (até 1024px) */
@media (max-width: 1024px) {
    /* Tela de consulta ocupa tela toda em mobile (sidebar escondida) */
    #tela-consulta {
        left: 0 !important;
        width: 100% !important;
    }

    /* Header da consulta */
    #tela-consulta .px-8 {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    #tela-consulta .py-6 {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    /* Grid de 2 colunas vira 1 coluna */
    #tela-consulta .lg\\:grid-cols-2 {
        grid-template-columns: 1fr !important;
    }

    /* Reduzir gaps */
    #tela-consulta .gap-8 {
        gap: 1rem !important;
    }

    /* Área de gravação e observações ficam empilhadas */
    #tela-consulta .h-full {
        height: auto !important;
        min-height: 400px;
    }

    /* Ajustar padding dos cards internos */
    #tela-consulta .p-12 {
        padding: 2rem !important;
    }
}

/* Mobile (até 640px) */
@media (max-width: 640px) {
    /* Reduzir ainda mais os paddings */
    #tela-consulta .px-8 {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    #tela-consulta .p-8 {
        padding: 1rem !important;
    }

    /* Fontes menores */
    #tela-consulta .text-2xl {
        font-size: 1.25rem !important;
        line-height: 1.75rem !important;
    }

    #tela-consulta .text-xl {
        font-size: 1.125rem !important;
        line-height: 1.5rem !important;
    }

    #tela-consulta .text-lg {
        font-size: 1rem !important;
    }

    /* Botões menores */
    #tela-consulta .px-6 {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    #tela-consulta .px-8 {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    #tela-consulta .py-3 {
        padding-top: 0.625rem;
        padding-bottom: 0.625rem;
    }

    /* Timer menor */
    #tela-consulta .text-2xl.font-mono {
        font-size: 1.5rem !important;
    }

    /* Esconder textos dos botões em telas muito pequenas */
    #tela-consulta button .mr-2 {
        margin-right: 0.25rem;
    }

    /* Área de gravação */
    #tela-consulta .rounded-3xl {
        border-radius: 1.5rem !important;
    }

    /* Visualizador de áudio menor */
    #tela-consulta .audio-bar {
        width: 0.5rem !important;
    }

    /* Textarea de observações */
    #tela-consulta textarea {
        min-height: 300px !important;
        font-size: 0.875rem !important;
    }

    /* Microfone central menor */
    #tela-consulta .w-32.h-32 {
        width: 6rem !important;
        height: 6rem !important;
    }

    #tela-consulta .text-5xl {
        font-size: 2.5rem !important;
    }
}

/* Mobile muito pequeno (até 380px) */
@media (max-width: 380px) {
    /* Header compacto */
    #tela-consulta .flex.items-center.space-x-4 {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }

    /* Botões do header empilhados */
    #tela-consulta .flex.items-center.space-x-4 {
        width: 100%;
    }

    #tela-consulta button {
        width: 100%;
        justify-content: center;
    }

    /* Timer full width */
    #tela-consulta .bg-gray-50.px-6 {
        width: 100%;
        text-align: center;
    }
}

/* ========================================
   FILTROS DE RELATÓRIOS
   ======================================== */

.filtro-periodo-btn {
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.filtro-periodo-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.filtro-periodo-btn:active {
    transform: translateY(0);
}

/* Estado ativo do botão de período */
.filtro-periodo-btn.border-blue-600 {
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* Animação suave ao trocar de período */
#filtro-datas-customizadas {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Info de filtros aplicados */
#filtros-info {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ========================================
   ANIMAÇÕES MODERNAS - Configurações
   ======================================== */

/* Animação de fade-in suave */
.animate-fade-in {
    animation: modernFadeIn 0.6s ease-out;
}

@keyframes modernFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animação de slide-up com escala */
.animate-slide-up {
    animation: modernSlideUp 0.5s ease-out backwards;
}

@keyframes modernSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Rotação lenta para ícone de engrenagem */
.animate-spin-slow {
    animation: spinSlow 8s linear infinite;
}

@keyframes spinSlow {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Animação de pop-in para modais */
@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ========================================
   ANIMAÇÕES ULTRA-MODERNAS - Consulta
   ======================================== */

/* Animação de blob orgânica para header de gravação */
@keyframes blob {
    0% {
        transform: translate(0px, 0px) scale(1);
    }
    33% {
        transform: translate(30px, -50px) scale(1.1);
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
    100% {
        transform: translate(0px, 0px) scale(1);
    }
}

.animate-blob {
    animation: blob 7s infinite;
}

/* Delays para criar efeito de ondas dessincronizadas */
.animation-delay-2000 {
    animation-delay: 2s;
}

.animation-delay-4000 {
    animation-delay: 4s;
}

/* Shimmer effect para headers de cards */
@keyframes shimmer {
    0% {
        transform: translateX(-100%) skewX(-20deg);
    }
    100% {
        transform: translateX(200%) skewX(-20deg);
    }
}

.animate-shimmer {
    animation: shimmer 3s infinite;
}

/* ========================================
   ZOOM 67% PARA RESOLUÇÕES HD NATIVAS
   Aplica apenas em monitores HD reais (1280x720, 1366x768)
   Evita conflito com Full HD + zoom do navegador
   ======================================== */

@media (min-width: 1280px) and (max-width: 1400px) {
    /* Aplica zoom uniforme em TUDO (sidebar + conteúdo) */
    body {
        zoom: 0.67;
    }

    /* Corrige altura da sidebar para compensar zoom */
    .sidebar {
        height: calc(100vh / 0.67); /* Compensa o zoom para ocupar 100% da tela */
    }

    /* LOGIN e INDEX: Zoom menor para ficar mais parecido com Full HD */
    body.login-page,
    body.index-page {
        zoom: 0.85; /* 85% - menos zoom que dashboard */
    }
}