:root {
    --primary-color: #037e9e;
    --primary-dark: #004288;
    --primary-light: #68aed3;
    --secondary-color: #586e37;
    --background: #f7f8f9;
    --card-background: #ffffff;
    --text-primary: #1f1f1f;
    --text-secondary: #5f6b70;
    --border-color: #e1e5e8;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-hover: 0 8px 20px rgba(0, 0, 0, 0.18);
    --transition: all 0.3s ease;
    --scout-green: #586e37;
    --scout-teal: #037e9e;
    --scout-purple: #004288;
    --scout-accent: #c9d300;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image: url("documents/C%C3%B3pia%20de%20B1%20RECRUTAMENTO%20E%20SELE%C3%87%C3%83O%20DE%20ADULTOS%20%281%29.png");
    background-repeat: no-repeat;
    background-position: right center;
    background-size: min(60vw, 720px) auto;
    background-attachment: fixed;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Header */
header {
    background: #ffffff;
    color: var(--text-primary);
    padding: 1.8rem 0 1.4rem;
    box-shadow: var(--shadow);
    border-top: 10px solid var(--scout-green);
    position: relative;
}

header::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 6px;
    background: var(--scout-teal);
    opacity: 0.85;
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.header-top {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.user-email {
    font-size: 0.9rem;
    opacity: 0.9;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.btn-logout {
    background: rgba(0, 0, 0, 0.05);
    border: 2px solid rgba(0, 0, 0, 0.12);
    color: var(--text-primary);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    font-family: inherit;
}

.btn-logout:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.logo-section h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Navigation */
.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.nav-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 2px solid rgba(0, 0, 0, 0.12);
    color: var(--text-primary);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.nav-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.nav-btn.active {
    background: var(--scout-teal);
    color: #ffffff;
    border-color: var(--scout-teal);
    font-weight: 700;
}

/* Main Content */
main {
    flex: 1;
    padding: 2rem 0;
}

/* Search Section */
.search-section {
    position: relative;
    margin-bottom: 2rem;
}

.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    transition: var(--transition);
    background: var(--card-background);
    color: var(--text-primary);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 95, 63, 0.1);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    pointer-events: none;
}

/* View Toggle */
.view-toggle {
    display: inline-flex;
    gap: 0.5rem;
    margin: -1rem 0 2rem;
    align-items: center;
}

.toggle-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 2px solid rgba(0, 0, 0, 0.12);
    color: var(--text-primary);
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}

.toggle-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.2);
}

.toggle-btn.active {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

/* Info Banner */
.info-banner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.category-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    flex-shrink: 0;
}

.category-A {
    background: #67AED3;
    color: #0b1a22;
}

.category-B {
    background: #568E3F;
    color: #ffffff;
}

.category-C {
    background: #EFC726;
    color: #1f1f1f;
}

.category-D {
    background: #C6533C;
    color: #ffffff;
}

.category-E {
    background: #CDD9E3;
    color: #1f1f1f;
}

.category-F {
    background: #8EC260;
    color: #1f1f1f;
}

/* Documents Grid */
.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    align-items: stretch; /* Cards com mesma altura */
}

.documents-grid.list-view {
    grid-template-columns: 1fr;
}

.documents-grid.list-view .document-card {
    flex-direction: row;
    align-items: stretch;
    gap: 1.5rem;
}

.documents-grid.list-view .document-header {
    flex: 1;
}

.documents-grid.list-view .document-actions {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
    border-left: 1px solid var(--border-color);
    padding-left: 1rem;
    min-width: 180px;
    justify-content: center;
}

.document-card {
    background: var(--card-background);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 2px solid rgba(0, 0, 0, 0.04);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 320px; /* Altura mínima ajustada para acomodar títulos de 3 linhas */
    height: 100%;
    animation: fadeIn 0.3s ease;
}

.document-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(0, 0, 0, 0.12);
}

.document-card.hidden {
    display: none;
}

.document-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex: 1;
    min-height: 0;
}

.document-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
    width: 2.5rem; /* Largura fixa */
    height: 2.5rem; /* Altura fixa */
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.document-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.document-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
    word-wrap: break-word;
    overflow: hidden;
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3; /* Limitar a 3 linhas */
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    min-height: calc(1.1rem * 1.4 * 3); /* Altura fixa para 3 linhas */
    max-height: calc(1.1rem * 1.4 * 3);
}

.document-category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content;
    height: 1.75rem; /* Altura fixa */
    line-height: 1.25rem;
    flex-shrink: 0;
}

.document-meta {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

.document-meta span {
    overflow: hidden;
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3; /* Limitar a 3 linhas */
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    min-height: calc(0.85rem * 1.5 * 3); /* Altura fixa para 3 linhas */
    max-height: calc(0.85rem * 1.5 * 3);
}

.document-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
}

.btn-primary {
    background: var(--primary-color);
    color: #0b0b0b;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(75, 139, 47, 0.35);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* No Results */
.no-results {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Footer */
footer {
    background: var(--scout-purple);
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: auto;
    border-top: 6px solid var(--scout-accent);
}

footer p {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Login Screen */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    background-color: var(--background);
    background-image: url("documents/C%C3%B3pia%20de%20B1%20RECRUTAMENTO%20E%20SELE%C3%87%C3%83O%20DE%20ADULTOS%20%281%29.png");
    background-repeat: no-repeat;
    background-position: right center;
    background-size: min(60vw, 720px) auto;
    padding: 2rem;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
}

.login-container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}

.login-card {
    background: var(--card-background);
    border-radius: 20px;
    padding: 3rem 2.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    width: 100%;
}

.login-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.login-header .subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
}

.login-body {
    text-align: left;
}

.login-body h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
    text-align: center;
}

.login-body > p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.7;
    text-align: center;
    font-size: 0.95rem;
}

.login-footer {
    margin-top: 2rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.auth-error {
    margin-top: 1rem;
    padding: 1rem;
    background: #fee;
    border: 2px solid #fcc;
    border-radius: 8px;
    color: #c33;
    font-size: 0.9rem;
    text-align: left;
    word-wrap: break-word;
}

.auth-error strong {
    font-weight: 600;
}

/* Google Sign-In Button Container */
.g_id_signin {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem 0;
    min-height: 50px;
}

/* Garantir que o botão do Google fica bem formatado */
.g_id_signin > div {
    margin: 0 auto;
}

/* Main Content Wrapper */
.main-content {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-top {
        flex-direction: column;
    }
    
    .user-section {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }
    
    .login-card {
        padding: 2rem 1.5rem;
    }
    
    .login-header h1 {
        font-size: 1.5rem;
    }
    
    .login-header {
        margin-bottom: 2rem;
        padding-bottom: 1rem;
    }
    
    .login-body h2 {
        font-size: 1.25rem;
    }
    .header-content {
        text-align: center;
    }

    .main-nav {
        justify-content: center;
    }

    .nav-btn {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
    }

    .logo-section h1 {
        font-size: 1.5rem;
    }

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

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

    .documents-grid.list-view .document-card {
        flex-direction: column;
    }

    .documents-grid.list-view .document-actions {
        border-left: 0;
        border-top: 1px solid var(--border-color);
        padding-left: 0;
        padding-top: 1rem;
        min-width: auto;
    }

    .document-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    main {
        padding: 1rem 0;
    }

    .container {
        padding: 0 15px;
    }

    header {
        padding: 1.5rem 0;
    }

    .search-input {
        padding: 0.85rem 0.85rem 0.85rem 2.5rem;
    }
    
    .user-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn-logout {
        width: 100%;
    }
    
    .login-screen {
        padding: 1rem;
    }
    
    .login-card {
        padding: 1.5rem 1.25rem;
        border-radius: 16px;
    }
    
    .login-header h1 {
        font-size: 1.35rem;
    }
    
    .login-body h2 {
        font-size: 1.15rem;
    }
    
    .login-body > p {
        font-size: 0.9rem;
    }
}

/* Loading Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    background: white;
    padding: 2rem 3rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--primary-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.loading-spinner::before {
    content: '';
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

