/* ==========================================================================
   CONSULTA DATAJUD - Layout Minimalista Sem Scroll
   ========================================================================== */

/* Imports */
@import url('base-design-system.css');
@import url('navbar.css');

/* ==========================================================================
   RESET E CONFIGURAÇÕES GLOBAIS - ALTURA FIXA
   ========================================================================== */

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

html, body {
    height: 100vh;
    overflow: hidden; /* Remove scroll global */
}

body {
    font-family: var(--font-sans);
    background: linear-gradient(135deg, #f5faff 0%, #ffffff 100%);
    color: var(--gray-900);
}

.App {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    flex-shrink: 0; /* Header não encolhe */
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.container {
    height: 100%;
    max-width: 1000px; /* Mais compacto */
    margin: 0 auto;
    padding: 0 var(--space-4);
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   FLOATING SHAPES MINIMALISTAS
   ========================================================================== */

.floating-shape {
    position: absolute;
    border-radius: 50%;
    animation: floatGentle 15s ease-in-out infinite;
    z-index: 0;
    opacity: 0.3; /* Mais sutil */
    filter: blur(3px);
}

.floating-shape:nth-child(1) {
    top: 10%;
    left: 5%;
    width: 80px;
    height: 80px;
    background: linear-gradient(45deg, rgba(111, 12, 99, 0.04), rgba(30, 58, 138, 0.03));
    animation-delay: 0s;
}

.floating-shape:nth-child(2) {
    top: 70%;
    right: 8%;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, rgba(111, 12, 99, 0.03), rgba(79, 172, 254, 0.03));
    animation-delay: -5s;
}

.floating-shape:nth-child(3) {
    top: 40%;
    right: 20%;
    width: 40px;
    height: 40px;
    background: linear-gradient(90deg, rgba(240, 147, 251, 0.03), rgba(245, 87, 108, 0.03));
    animation-delay: -10s;
}

/* Animação mais suave */
@keyframes floatGentle {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-10px, -10px) rotate(180deg); }
}

/* ==========================================================================
   LAYOUT PRINCIPAL COMPACTO
   ========================================================================== */

.search-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    padding: var(--space-4) 0;
}

.search-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 100%;
}

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

.page-title-section {
    text-align: center;
    margin-bottom: var(--space-4);
    flex-shrink: 0;
}

.page-title {
    font-size: 2rem; /* Menor */
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-2);
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.page-title i {
    color: var(--primary-purple);
    font-size: 2rem;
}

.page-subtitle {
    font-size: 0.9rem; /* Menor */
    color: var(--gray-600);
    font-weight: 300;
}

/* ==========================================================================
   ÁREA DE BUSCA COMPACTA
   ========================================================================== */

.search-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Importante para flex */
}

.search-type-selection {
    margin-bottom: var(--space-4);
    flex-shrink: 0;
}

.radio-group {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    background: var(--gray-50);
    padding: var(--space-2);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.radio-option {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.radio-option:hover {
    background: white;
    box-shadow: var(--shadow-sm);
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 16px;
    height: 16px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    position: relative;
    transition: all 0.3s ease;
}

.radio-option input[type="radio"]:checked + .radio-custom {
    border-color: var(--primary-purple);
    background: var(--primary-purple);
}

.radio-option input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
}

.radio-label {
    font-weight: 500;
    color: var(--gray-700);
}

/* ==========================================================================
   FORMULÁRIOS COMPACTOS
   ========================================================================== */

.search-form-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.quick-search-card,
.advanced-search-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-100);
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Busca Rápida */
.search-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    flex: 1;
    justify-content: center;
}

.input-group {
    display: flex;
    align-items: center;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    padding: var(--space-2);
    transition: all 0.3s ease;
    position: relative;
    min-height: 48px;
}

.input-group:focus-within {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(111, 12, 99, 0.1);
}

.input-icon {
    position: absolute;
    left: var(--space-3);
    color: var(--gray-400);
    font-size: 1.1rem;
    z-index: 2;
    top: 50%;
    transform: translateY(-50%);
}

.search-input-main {
    flex: 1;
    border: none;
    background: transparent;
    padding: var(--space-3) var(--space-4) var(--space-3) 2.5rem;
    font-size: 1rem;
    color: var(--gray-900);
    outline: none;
    min-width: 0;
    transition: all 0.3s ease;
    height: 100%;
}

.search-input-main::placeholder {
    color: var(--gray-400);
    opacity: 0.8;
    transition: all 0.3s ease;
}

.search-input-main:focus::placeholder {
    opacity: 0;
    transform: translateX(10px);
}

.search-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    transition: all 0.3s ease;
    font-size: 0.9rem;
    flex-shrink: 0;
    margin-left: var(--space-2);
}

.search-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Busca Avançada Compacta */
.advanced-form {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    flex: 1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.form-group label {
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-select,
.form-input {
    padding: var(--space-3);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: var(--gray-50);
    color: var(--gray-900);
    transition: all 0.3s ease;
}

.form-select:focus,
.form-input:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 2px rgba(111, 12, 99, 0.1);
    background: white;
}

.form-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-3);
    flex-shrink: 0;
}

.btn-primary,
.btn-secondary {
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    transition: all 0.3s ease;
    border: none;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-purple);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

/* ==========================================================================
   SEÇÃO DE RESULTADOS COMPACTA
   ========================================================================== */

.results-section {
    display: none; /* Oculta por padrão */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 10;
    padding: var(--space-4);
    overflow-y: auto;
}

.results-section.active {
    display: flex;
    flex-direction: column;
}

.results-header {
    text-align: center;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--gray-200);
}

.results-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-2);
}

.results-count {
    color: var(--gray-600);
    font-size: 0.9rem;
}

.back-to-search {
    position: absolute;
    top: var(--space-4);
    left: var(--space-4);
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.9rem;
    color: var(--gray-700);
    transition: all 0.3s ease;
}

.back-to-search:hover {
    background: var(--gray-200);
}

/* ==========================================================================
   POPULAR SEARCHES INTEGRADAS
   ========================================================================== */

.popular-searches-compact {
    margin-top: var(--space-4);
    text-align: center;
    flex-shrink: 0;
}

.popular-searches-compact h4 {
    font-size: 0.8rem;
    color: var(--gray-600);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.popular-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2);
}

.popular-tag {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    font-weight: 500;
}

.popular-tag:hover {
    background: var(--primary-gradient);
    color: white;
    transform: translateY(-1px);
}

/* ==========================================================================
   ANIMAÇÕES DE TRANSIÇÃO
   ========================================================================== */

.search-form-container {
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.search-form-container.fade-in {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   RESPONSIVIDADE PARA TELAS MENORES
   ========================================================================== */

@media (max-height: 600px) {
    .page-title {
        font-size: 1.5rem;
    }
    
    .page-title i {
        font-size: 1.5rem;
    }
    
    .page-subtitle {
        font-size: 0.8rem;
    }
    
    .quick-search-card,
    .advanced-search-card {
        padding: var(--space-4);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-3);
    }
    
    .page-title {
        font-size: 1.8rem;
        flex-direction: column;
        gap: var(--space-1);
    }
    
    .radio-group {
        flex-direction: column;
        gap: var(--space-2);
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: var(--space-2);
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .popular-tags {
        flex-direction: column;
        align-items: center;
    }
    
    .popular-tag {
        width: 100%;
        max-width: 200px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .input-group {
        flex-direction: column;
        gap: var(--space-2);
        align-items: stretch;
    }
    
    .search-btn {
        width: 100%;
        justify-content: center;
    }
    
    .quick-search-card,
    .advanced-search-card {
        padding: var(--space-3);
    }
}

/* ==========================================================================
   RETÂNGULOS DECORATIVOS DE FUNDO
   ========================================================================== */

.background-rectangles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -2;
    overflow: hidden;
}

.bg-rect {
    position: absolute;
    background: linear-gradient(135deg, rgba(111, 12, 99, 0.05), rgba(30, 58, 138, 0.08));
    border-radius: 12px;
    filter: blur(0.5px);
    animation: float-rect 20s ease-in-out infinite;
}

.rect-1 {
    width: 200px;
    height: 120px;
    top: 10%;
    left: -50px;
    transform: rotate(-15deg);
    animation-delay: 0s;
    animation-duration: 25s;
}

.rect-2 {
    width: 150px;
    height: 80px;
    top: 30%;
    right: -30px;
    transform: rotate(20deg);
    animation-delay: -5s;
    animation-duration: 30s;
}

.rect-3 {
    width: 180px;
    height: 100px;
    bottom: 20%;
    left: 5%;
    transform: rotate(10deg);
    animation-delay: -10s;
    animation-duration: 35s;
}

.rect-4 {
    width: 120px;
    height: 200px;
    top: 50%;
    right: 10%;
    transform: rotate(-25deg);
    animation-delay: -15s;
    animation-duration: 28s;
}

.rect-5 {
    width: 160px;
    height: 90px;
    bottom: 40%;
    right: -40px;
    transform: rotate(35deg);
    animation-delay: -8s;
    animation-duration: 32s;
}

.rect-6 {
    width: 140px;
    height: 110px;
    top: 70%;
    left: -20px;
    transform: rotate(-30deg);
    animation-delay: -12s;
    animation-duration: 26s;
}

@keyframes float-rect {
    0%, 100% {
        transform: translateY(0px) translateX(0px) rotate(var(--initial-rotation, 0deg));
        opacity: 0.3;
    }
    25% {
        transform: translateY(-30px) translateX(20px) rotate(calc(var(--initial-rotation, 0deg) + 5deg));
        opacity: 0.6;
    }
    50% {
        transform: translateY(-60px) translateX(-15px) rotate(calc(var(--initial-rotation, 0deg) + 10deg));
        opacity: 0.8;
    }
    75% {
        transform: translateY(-30px) translateX(25px) rotate(calc(var(--initial-rotation, 0deg) + 5deg));
        opacity: 0.6;
    }
}

/* Variações de rotação inicial */
.rect-1 { --initial-rotation: -15deg; }
.rect-2 { --initial-rotation: 20deg; }
.rect-3 { --initial-rotation: 10deg; }
.rect-4 { --initial-rotation: -25deg; }
.rect-5 { --initial-rotation: 35deg; }
.rect-6 { --initial-rotation: -30deg; }