/* ============================================
   RADI - CSS MODERNO PROFISSIONAL
   ============================================ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --gray: #64748b;
    --gray-light: #f1f5f9;
    --dark: #0f172a;
    --white: #ffffff;
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f1f5f9;
    display: flex;
    flex-direction: column;
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
    background: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 64px;
    border-bottom: 1px solid #e2e8f0;
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.logo i {
    font-size: 1.5rem;
}

.nav-menu {
    display: flex;
    gap: 4px;
    list-style: none;
}

.nav-menu li a {
    color: var(--gray);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 0.875rem;
}

.nav-menu li a:hover {
    background: var(--gray-light);
    color: var(--primary);
}

.nav-menu li a.active {
    background: var(--primary);
    color: white;
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--dark);
    font-weight: 500;
    font-size: 0.875rem;
}

.logout-btn {
    background: var(--danger);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.2s;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */
.app-wrapper {
    display: flex;
    margin-top: 64px;
    flex: 1;
    height: calc(100vh - 64px);
    overflow: hidden;
}

/* Sidebar de filtros */
.sidebar-filters {
    width: 280px;
    background: white;
    border-right: 1px solid #e2e8f0;
    padding: 20px;
    overflow-y: auto;
    flex-shrink: 0;
    height: 100%;
}

/* Conteúdo principal */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    height: 100%;
}

/* Footer */
.footer {
    text-align: center;
    padding: 12px 20px;
    color: var(--gray);
    font-size: 0.7rem;
    border-top: 1px solid #e2e8f0;
    background: white;
    flex-shrink: 0;
}

/* ============================================
   FILTROS
   ============================================ */
.filter-section h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group {
    margin-bottom: 16px;
}

.filter-group label {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 4px;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.8rem;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-filter {
    flex: 1;
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
}

.btn-filter:hover {
    background: var(--primary-dark);
}

.btn-clear {
    flex: 1;
    background: var(--gray-light);
    color: #475569;
    border: none;
    padding: 8px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.btn-clear:hover {
    background: #e2e8f0;
}

/* ============================================
   TABELAS
   ============================================ */
.table-container {
    background: white;
    border-radius: 12px;
    overflow-x: auto;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.875rem;
}

/* ============================================
   BOTÕES
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray);
    color: white;
}

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

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

.btn-sm {
    padding: 4px 10px;
    font-size: 0.75rem;
}

/* ============================================
   ALERTAS
   ============================================ */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
    background: white;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header h1 i {
    color: var(--primary);
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    .nav-menu {
        position: fixed;
        top: 64px;
        left: -100%;
        width: 80%;
        max-width: 280px;
        height: calc(100vh - 64px);
        background: white;
        flex-direction: column;
        padding: 20px;
        gap: 8px;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        z-index: 99;
    }
    
    .nav-menu.open {
        left: 0;
    }
    
    .sidebar-filters {
        position: fixed;
        left: -100%;
        top: 64px;
        width: 85%;
        max-width: 320px;
        height: calc(100vh - 64px);
        z-index: 100;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .sidebar-filters.open {
        left: 0;
    }
    
    .filter-toggle-btn {
        display: flex;
        position: fixed;
        bottom: 20px;
        right: 20px;
        background: var(--primary);
        color: white;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        border: none;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        z-index: 99;
        align-items: center;
        justify-content: center;
    }
    
    .filter-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 98;
    }
    
    .filter-overlay.open {
        display: block;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .user-name span {
        display: none;
    }
}

.filter-toggle-btn {
    display: none;
}

.text-center {
    text-align: center;
}

/* ============================================
   DASHBOARD - CARDS
   ============================================ */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #e2e8f0;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.card-icon {
    width: 48px;
    height: 48px;
    background: #eef2ff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.card-icon i {
    font-size: 24px;
    color: var(--primary);
}

.card h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.card .number {
    font-size: 2rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.card .trend {
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.trend-up {
    color: #10b981;
}

.trend-down {
    color: #ef4444;
}

/* ============================================
   FORMULÁRIOS
   ============================================ */
.form-container {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.875rem;
    color: #0f172a;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
    margin-bottom: 0;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* ============================================
   FORMULÁRIO - LARGURA MAIOR E MAIS COMPACTO
   ============================================ */
.form-container {
    background: white;
    border-radius: 12px;
    padding: 32px 40px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 0.8rem;
    color: #334155;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: all 0.2s;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.radio-group {
    display: flex;
    gap: 24px;
    margin-top: 5px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
    margin-bottom: 0;
    font-size: 0.85rem;
}

textarea.form-control {
    resize: vertical;
    min-height: 70px;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 32px;
}

/* Botões do formulário */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

@media (max-width: 768px) {
    .form-container {
        padding: 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .radio-group {
        gap: 16px;
    }
}

/* ============================================
   FORMULÁRIO - MESMA LARGURA DO CONTEÚDO
   ============================================ */
.form-container {
    background: white;
    border-radius: 12px;
    padding: 32px 40px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

/* Ajuste para quando há sidebar */
.app-wrapper:not(.no-sidebar) .form-container {
    max-width: none;
}

/* Quando não há sidebar, já ocupa toda largura */
.no-sidebar .main-content {
    padding: 20px;
}

.no-sidebar .form-container {
    margin-left: 0;
    margin-right: 0;
}

@media (max-width: 768px) {
    .form-container {
        padding: 20px;
    }
}
