@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #10b981;
    --primary-glow: rgba(16, 185, 129, 0.2);
    --primary-dark: #059669;
    --bg-deep: #0a0f1d;
    --bg-card: rgba(23, 31, 51, 0.7);
    --bg-sidebar: #0f172a;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.1);
    --danger: #ff4d4d;
    --success: #00e676;
    --warning: #ffb74d;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--bg-deep);
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-deep);
    background-image: 
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.05) 0px, transparent 50%);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }

/* Auth Layout */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 3rem;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-header img {
    max-width: 140px;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.auth-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

/* Forms */
.form-group { margin-bottom: 1.5rem; }

.form-label {
    display: block;
    margin-bottom: 0.6rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 0.9rem 1.2rem;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.6);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.btn-primary:active { transform: translateY(0); }

/* Main App Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    border-right: 1px solid var(--border);
    z-index: 100;
}

.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 3rem;
    max-width: 1400px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3.5rem;
    padding-left: 0.5rem;
}

.nav-menu { list-style: none; flex: 1; }
.nav-item { margin-bottom: 0.75rem; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-weight: 500;
}

.nav-link:hover, .nav-link.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
}

.nav-link span:first-child {
    font-size: 1.2rem;
    transition: var(--transition);
}

.nav-link:hover span:first-child { transform: scale(1.2) rotate(5deg); }

/* Stats & Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.stat-title {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

/* Tables */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }
th {
    background: rgba(0, 0, 0, 0.2);
    text-align: left;
    padding: 1.25rem 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* Badges */
.badge {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-open { background: rgba(255, 183, 77, 0.15); color: var(--warning); }
.badge-success { background: rgba(0, 230, 118, 0.15); color: var(--success); }

/* Responsive Layout Improvements */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    align-items: center;
    justify-content: space-between;
    z-index: 200;
    backdrop-filter: blur(10px);
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: var(--transition);
        width: 280px;
        box-shadow: 20px 0 50px rgba(0,0,0,0.5);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .mobile-header {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding: 5rem 1.5rem 2rem 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    /* Formulários mais profissionais em Mobile */
    .form-control {
        padding: 1rem 1.25rem; /* Aumentar touch target */
        font-size: 1.05rem;
    }

    /* Correção do Layout Principal */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 5rem 1rem 2rem 1rem !important;
        overflow-x: hidden;
    }

    /* Grelhas de Estatísticas (Dashboard) */
    .stats-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Formulários e Detalhes de Processo */
    form div[style*="grid-template-columns"],
    .main-content > div[style*="grid-template-columns"],
    div[style*="grid-template-columns: 1fr 1.5fr"] {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    /* Atividade do Dashboard - MANTER LADO A LADO */
    div[style*="display: flex; gap: 1rem"] {
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-start !important;
    }

    /* Timeline */
    .timeline {
        padding-left: 1.5rem !important;
        position: relative;
    }
    .timeline::before {
        left: 5px !important;
        background: rgba(255, 255, 255, 0.1) !important;
    }
    .timeline-dot {
        left: -3px !important;
        top: 20px !important;
        width: 16px;
        height: 16px;
        position: absolute;
    }

    /* Botões Mobile */
    .btn {
        width: 100% !important;
        justify-content: center !important;
    }

    header[style*="display: flex"] {
        display: block !important;
    }

    /* Resultados da Pesquisa */
    .main-content .stat-card[style*="display: flex"] {
        display: block !important;
        text-align: center;
    }

    .main-content .stat-card[style*="display: flex"] .btn {
        margin-top: 1rem;
    }

    /* Formulário de Pesquisa */
    form[style*="display: flex"] {
        display: block !important;
    }

    form[style*="display: flex"] .form-control {
        margin-bottom: 1rem;
    }
}
    .timeline-item .stat-card {
        padding: 1.25rem !important;
    }

    /* Forçar nome e data a ficarem em linhas separadas */
    .timeline-item .stat-card div[style*="display: flex"] {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.25rem !important;
        margin-bottom: 0.75rem !important;
    }

    .timeline-item .stat-card div[style*="display: flex"] span:last-child {
        font-size: 0.7rem !important;
        opacity: 0.6;
    }

    .form-group {
        margin-bottom: 1.5rem !important;
        width: 100% !important;
    }

    /* Inputs com mais contraste */
    .form-control {
        background: rgba(30, 41, 59, 0.8) !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        padding: 1.1rem !important;
        font-size: 1rem !important;
    }

    .form-label {
        font-size: 0.95rem !important;
        font-weight: 600 !important;
        margin-bottom: 0.5rem !important;
        display: block !important;
        color: var(--text-main) !important;
        opacity: 1 !important;
        white-space: nowrap; /* Impede quebras de linha nas labels */
    }

    .stat-card {
        padding: 2rem 1.5rem !important;
        margin-bottom: 1.5rem !important;
        border-radius: var(--radius-md) !important;
        max-width: 100% !important;
    }

    /* Ajuste de botões */
    .btn {
        margin-top: 1rem;
        height: 55px; /* Altura ideal para toque */
    }

    /* Esconder linhas separadoras no mobile para limpar o visual */
    form hr {
        display: none !important;
    }

    /* Transformar Tabelas em Cards (Mobile) */
    .table-container {
        background: none !important;
        border: none !important;
    }

    table, thead, tbody, th, td, tr {
        display: block !important;
    }

    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr {
        background: var(--bg-card) !important;
        margin-bottom: 1.5rem !important;
        border-radius: var(--radius-md) !important;
        border: 1px solid var(--glass-border) !important;
        padding: 1rem !important;
        box-shadow: var(--shadow);
    }

    td {
        border: none !important;
        position: relative !important;
        padding-left: 50% !important;
        text-align: right !important;
        margin-bottom: 0.75rem !important;
        min-height: 2.5rem;
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
    }

    td:before {
        content: attr(data-label);
        position: absolute;
        left: 1rem;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: 700;
        color: var(--text-muted);
        font-size: 0.8rem;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    td[data-label="Ação"] {
        margin-top: 1rem;
        padding-left: 1rem !important;
        text-align: center !important;
        justify-content: center !important;
    }

    td[data-label="Ação"]:before {
        display: none;
    }

    td[data-label="Ação"] .btn {
        width: 100% !important;
        background: var(--primary) !important;
        color: white !important;
        height: 50px;
    }

    /* Títulos em Mobile */
    .main-content header {
        margin-bottom: 2.5rem;
        text-align: center;
    }

    .main-content header h1 {
        font-size: 1.8rem;
        letter-spacing: -0.5px;
        line-height: 1.2;
    }
}

/* Overlay para o menu mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 90;
}

.sidebar-overlay.active {
    display: block;
}
