/* ============================================
   ESTILOS ESPECÍFICOS - PORTAL DO PACIENTE
   Design moderno, responsivo e acessível
   ============================================ */

/* Imagem de fundo - Cuidado com o paciente */
body.portal-paciente {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    /* Fallback: gradiente médico */
    background: linear-gradient(135deg, rgba(44, 90, 160, 0.95) 0%, rgba(30, 61, 111, 0.95) 100%),
                /* Padrão médico como fallback */
                repeating-linear-gradient(
                    45deg,
                    transparent,
                    transparent 10px,
                    rgba(255, 255, 255, 0.03) 10px,
                    rgba(255, 255, 255, 0.03) 20px
                );
    /* Imagem de fundo - cuidado médico */
    background-image: 
        linear-gradient(135deg, rgba(44, 90, 160, 0.92) 0%, rgba(30, 61, 111, 0.92) 100%),
        url('https://images.unsplash.com/photo-1559757148-5c350d0d3c56?ixlib=rb-4.0.3&auto=format&fit=crop&w=2000&q=80');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    padding: 0;
    margin: 0;
    color: #333;
}

/* Overlay adicional para melhor legibilidade */
body.portal-paciente::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(44, 90, 160, 0.85) 0%, rgba(30, 61, 111, 0.85) 100%);
    z-index: 0;
    pointer-events: none;
}

/* Container do portal do paciente */
.portal-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Login Box - Portal do Paciente */
.portal-login-box {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    padding: 50px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(255, 255, 255, 0.1);
    max-width: 480px;
    width: 100%;
    margin: 20px auto;
    animation: fadeInUp 0.6s ease-out;
    position: relative;
    overflow: hidden;
}

.portal-login-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--cor-primaria), var(--cor-destaque), var(--cor-primaria));
    background-size: 200% 100%;
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.portal-login-box .logo-container {
    margin-bottom: 30px;
}

.portal-login-box .logo {
    max-height: 80px;
    width: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.portal-login-box h1 {
    color: var(--cor-primaria);
    margin-bottom: 10px;
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.portal-login-box .subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 35px;
    font-size: 15px;
    line-height: 1.6;
}

/* Formulário do portal */
.portal-login-box .form-group {
    margin-bottom: 25px;
}

.portal-login-box .form-group label {
    display: block;
    margin-bottom: 10px;
    color: #555;
    font-weight: 600;
    font-size: 14px;
}

.portal-login-box .form-group input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #fafafa;
}

.portal-login-box .form-group input:focus {
    outline: none;
    border-color: var(--cor-primaria);
    background: white;
    box-shadow: 0 0 0 4px rgba(44, 90, 160, 0.1);
    transform: translateY(-1px);
}

.portal-login-box .btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--cor-primaria), var(--cor-destaque));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(44, 90, 160, 0.3);
    margin-top: 10px;
}

.portal-login-box .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 90, 160, 0.4);
}

.portal-login-box .btn-primary:active {
    transform: translateY(0);
}

/* Dashboard do Paciente */
.portal-dashboard {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.portal-header {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    padding: 25px 35px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    animation: fadeInDown 0.6s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.portal-header .logo-container-header {
    display: flex;
    align-items: center;
    gap: 20px;
}

.portal-header .logo-header {
    max-height: 55px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.portal-header h1 {
    color: var(--cor-primaria);
    font-size: 26px;
    font-weight: 700;
    margin: 0;
}

.portal-content-box {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    padding: 35px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    margin-bottom: 25px;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.portal-content-box h2 {
    color: var(--cor-primaria);
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--cor-primaria);
    font-size: 24px;
    font-weight: 700;
}

/* Cards de Exames (Alternativa à tabela) */
.exames-grid {
    display: none; /* Oculto por padrão - será mostrado via JS em mobile */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 25px;
}

@media (max-width: 768px) {
    .exames-grid {
        display: grid; /* Mostrar cards em mobile */
    }
    
    .portal-table-responsive {
        display: none; /* Ocultar tabela em mobile */
    }
}

.exame-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    padding: 25px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.exame-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--cor-primaria);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.exame-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(44, 90, 160, 0.2);
    border-color: var(--cor-primaria);
}

.exame-card:hover::before {
    transform: scaleY(1);
}

.exame-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.exame-card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--cor-primaria);
    margin: 0;
    flex: 1;
}

.exame-card-icon {
    font-size: 32px;
    color: var(--cor-destaque);
    opacity: 0.7;
}

.exame-card-info {
    margin-bottom: 15px;
}

.exame-card-info-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
}

.exame-card-info-item strong {
    color: #333;
    margin-right: 8px;
    min-width: 120px;
}

.exame-card-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

/* Tabela Responsiva */
.portal-table-responsive {
    overflow-x: auto;
    margin-top: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.portal-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.portal-table thead {
    background: linear-gradient(135deg, var(--cor-primaria), var(--cor-destaque));
    color: white;
}

.portal-table th {
    padding: 18px 20px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.portal-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
}

.portal-table tbody tr:hover {
    background: #f8f9fa;
    transform: scale(1.01);
}

.portal-table tbody tr:last-child {
    border-bottom: none;
}

.portal-table td {
    padding: 18px 20px;
    color: #333;
    font-size: 15px;
}

.portal-table .observacoes {
    background: #f8f9fa;
    font-size: 13px;
    color: #666;
    padding: 15px 20px;
}

/* Botões do Portal */
.portal-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    text-align: center;
}

.portal-btn-primary {
    background: linear-gradient(135deg, var(--cor-primaria), var(--cor-destaque));
    color: white;
    box-shadow: 0 4px 15px rgba(44, 90, 160, 0.3);
}

.portal-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 90, 160, 0.4);
}

.portal-btn-secondary {
    background: #6c757d;
    color: white;
}

.portal-btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.portal-btn-sm {
    padding: 10px 20px;
    font-size: 13px;
}

/* Alerts do Portal */
.portal-alert {
    padding: 18px 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    border-left: 4px solid;
    animation: slideInRight 0.4s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.portal-alert-info {
    background: #e7f3ff;
    color: #004085;
    border-color: #004085;
}

.portal-alert-error {
    background: #ffe7e7;
    color: #721c24;
    border-color: #721c24;
}

/* Links do Portal */
.portal-login-links {
    text-align: center;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid #e0e0e0;
}

.portal-login-links a {
    color: var(--cor-primaria);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.portal-login-links a:hover {
    color: var(--cor-destaque);
    transform: translateX(5px);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    color: #666;
    margin-bottom: 10px;
    font-size: 20px;
}

.empty-state p {
    color: #999;
    font-size: 15px;
}

/* ============================================
   RESPONSIVIDADE - MOBILE FIRST
   ============================================ */

/* Tablets (768px e abaixo) */
@media (max-width: 768px) {
    body.portal-paciente {
        background-attachment: scroll;
        /* Fallback para mobile - melhor performance */
        background-image: linear-gradient(135deg, rgba(44, 90, 160, 0.95) 0%, rgba(30, 61, 111, 0.95) 100%);
    }

    .portal-login-box {
        padding: 40px 30px;
        margin: 15px;
        border-radius: 16px;
    }

    .portal-login-box h1 {
        font-size: 24px;
    }

    .portal-header {
        padding: 20px 25px;
        border-radius: 16px;
        flex-direction: column;
        align-items: flex-start;
    }

    .portal-header .logo-container-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .portal-header h1 {
        font-size: 20px;
    }

    .portal-content-box {
        padding: 25px 20px;
        border-radius: 16px;
    }

    .exames-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .portal-table {
        font-size: 13px;
    }

    .portal-table th,
    .portal-table td {
        padding: 12px 15px;
    }
}

/* Celulares (480px e abaixo) */
@media (max-width: 480px) {
    .portal-container {
        padding: 10px;
    }

    .portal-login-box {
        padding: 30px 20px;
        border-radius: 12px;
    }

    .portal-login-box .logo {
        max-height: 60px;
    }

    .portal-login-box h1 {
        font-size: 22px;
    }

    .portal-login-box .subtitle {
        font-size: 14px;
        margin-bottom: 25px;
    }

    .portal-header {
        padding: 15px 20px;
        border-radius: 12px;
    }

    .portal-header .logo-header {
        max-height: 45px;
    }

    .portal-header h1 {
        font-size: 18px;
    }

    .portal-content-box {
        padding: 20px 15px;
        border-radius: 12px;
    }

    .portal-content-box h2 {
        font-size: 20px;
    }

    .portal-table {
        font-size: 12px;
    }

    .portal-table th,
    .portal-table td {
        padding: 10px 12px;
    }

    .exame-card {
        padding: 20px;
    }

    .portal-btn {
        padding: 10px 20px;
        font-size: 13px;
    }
}

/* Telas muito pequenas (360px e abaixo) */
@media (max-width: 360px) {
    .portal-login-box {
        padding: 25px 15px;
    }

    .portal-header {
        padding: 15px;
    }

    .portal-content-box {
        padding: 15px;
    }
}

/* Orientação Landscape em Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .portal-container {
        padding: 10px;
    }

    .portal-login-box {
        max-width: 600px;
        padding: 30px 40px;
    }
}

/* Acessibilidade - Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Melhorias de Acessibilidade */
.portal-login-box:focus-within,
.portal-content-box:focus-within {
    outline: 3px solid var(--cor-destaque);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    body.portal-paciente {
        background: white;
    }

    .portal-header,
    .portal-content-box {
        box-shadow: none;
        background: white;
    }
}

