/* ============================================
   SISTEMA DE CORES CLEAN
   ============================================ */
:root {
    --primary: #4F46E5;           /* Azul moderno */
    --primary-light: #6366F1;
    --primary-dark: #4338CA;
    --secondary: #8B5CF6;         /* Roxo */
    --success: #10B981;           /* Verde */
    --danger: #EF4444;            /* Vermelho */
    --warning: #F59E0B;           /* Âmbar */
    --info: #0EA5E9;              /* Azul claro */
    
    --neutral-50: #F9FAFB;
    --neutral-100: #F3F4F6;
    --neutral-200: #E5E7EB;
    --neutral-300: #D1D5DB;
    --neutral-400: #9CA3AF;
    --neutral-500: #6B7280;
    --neutral-600: #4B5563;
    --neutral-700: #374151;
    --neutral-800: #1F2937;
    --neutral-900: #111827;
    
    --border: #E5E7EB;
    --bg-light: #F9FAFB;
    --muted: #6B7280;
    --radius: 8px;
    --transition: 0.3s ease;
}

/* ============================================
   RESET E LAYOUT BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
    background: var(--neutral-50);
    color: var(--neutral-900);
    font-size: 1rem;
    line-height: 1.6;
}

/* ============================================
   LAYOUT WRAPPER
   ============================================ */
.layout-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ============================================
   SIDEBAR (Desktop)
   ============================================ */
.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 1.1rem;
}

.sidebar-brand i {
    font-size: 1.5rem;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--neutral-700);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all var(--transition);
    font-size: 0.95rem;
}

.sidebar-nav a:hover {
    background: var(--neutral-100);
    color: var(--primary);
}

.sidebar-nav a.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    font-weight: 600;
}

.sidebar-nav a i {
    font-size: 1.1rem;
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius);
    background: var(--neutral-100);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.sidebar-user i {
    font-size: 1.3rem;
    color: var(--primary);
}

.sidebar-user-name {
    flex: 1;
    font-weight: 600;
    color: var(--neutral-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-actions {
    display: flex;
    gap: 8px;
}

.btn-sidebar-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--neutral-200);
    color: var(--neutral-800);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all var(--transition);
}

.btn-sidebar-action:hover {
    background: var(--neutral-300);
    color: var(--neutral-900);
}

.btn-sidebar-action i {
    font-size: 0.95rem;
}

/* ============================================
   HEADER MOBILE (Fixed no topo)
   ============================================ */
.navbar-top {
    display: none;
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
}

.navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 1rem;
}

.navbar-brand i {
    font-size: 1.3rem;
}

.navbar-toggle {
    background: none;
    border: none;
    color: var(--neutral-900);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.navbar-toggle:hover {
    color: var(--primary);
}

.navbar-user-mobile {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--neutral-700);
}

.navbar-user-mobile i {
    font-size: 1.2rem;
    color: var(--primary);
}

/* ============================================
   MENU DROPDOWN MOBILE
   ============================================ */
.mobile-menu {
    display: none !important;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 10001;
    flex-direction: column;
}

.mobile-menu.show {
    display: flex !important;
}

.mobile-menu-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--neutral-100);
}

.mobile-menu-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--neutral-900);
}

.mobile-menu-user i {
    font-size: 1.3rem;
    color: var(--primary);
}

.mobile-menu-nav {
    flex: 1;
    list-style: none;
    padding: 8px;
}

.mobile-menu-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--neutral-700);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.mobile-menu-nav a:hover {
    background: var(--neutral-100);
    color: var(--primary);
}

.mobile-menu-nav a.active {
    background: var(--neutral-200);
    color: var(--primary);
    font-weight: 600;
}

.mobile-menu-nav i {
    font-size: 1.1rem;
    width: 20px;
}

.mobile-menu-actions {
    padding: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-menu-actions a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: var(--neutral-200);
    color: var(--neutral-800);
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all var(--transition);
}

.mobile-menu-actions a:hover {
    background: var(--neutral-300);
}

/* ============================================
   OVERLAY (Mobile)
   ============================================ */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
}

.mobile-overlay.show {
    display: block;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-content-inner {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

.page-header {
    background: white;
    padding: 24px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--neutral-900);
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title i {
    color: var(--primary);
    font-size: 1.8rem;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all var(--transition);
    border: none;
    margin-bottom: 20px;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.card-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 20px;
    font-weight: 600;
    font-size: 1.1rem;
}

.card-body {
    padding: 24px;
}

/* ============================================
   FORMULÁRIOS
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    font-weight: 600;
    color: var(--neutral-900);
    margin-bottom: 8px;
    display: block;
    font-size: 0.95rem;
}

.form-control,
.form-select {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 0.95rem;
    transition: all var(--transition);
    font-family: inherit;
    width: 100%;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}

.form-control::placeholder {
    color: var(--muted);
}

/* ============================================
   BOTÕES
   ============================================ */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: var(--neutral-200);
    color: var(--neutral-900);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--neutral-300);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    opacity: 0.9;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    opacity: 0.9;
}

.btn-info {
    background: var(--info);
    color: white;
}

.btn-info:hover {
    opacity: 0.9;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   TABELAS
   ============================================ */
.table-wrapper {
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.table-scroll {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 600px;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    min-width: 800px;
}

.table thead {
    background: var(--neutral-100);
    position: sticky;
    top: 0;
    z-index: 10;
}

.table th {
    padding: 12px 16px;
    font-weight: 600;
    color: var(--neutral-900);
    border-bottom: 2px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.table tbody tr:hover {
    background: var(--neutral-50);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ============================================
   ALERTAS
   ============================================ */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius);
    border: none;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.alert i {
    margin-top: 2px;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.alert-info {
    background: #DBEAFE;
    color: #1E40AF;
    border-left: 4px solid #1E40AF;
}

.alert-success {
    background: #DCFCE7;
    color: #166534;
    border-left: 4px solid #166534;
}

.alert-warning {
    background: #FEF3C7;
    color: #92400E;
    border-left: 4px solid #92400E;
}

.alert-danger {
    background: #FEE2E2;
    color: #991B1B;
    border-left: 4px solid #991B1B;
}

/* ============================================
   UTILITÁRIOS
   ============================================ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.text-muted {
    color: var(--muted);
}

.text-center {
    text-align: center;
}

.text-end {
    text-align: right;
}

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mb-5 { margin-bottom: 32px; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mt-5 { margin-top: 32px; }

.p-1 { padding: 8px; }
.p-2 { padding: 12px; }
.p-3 { padding: 16px; }
.p-4 { padding: 24px; }

.gap-1 { gap: 8px; }
.gap-2 { gap: 12px; }
.gap-3 { gap: 16px; }

.d-flex {
    display: flex;
}

.d-grid {
    display: grid;
}

.flex-wrap {
    flex-wrap: wrap;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* ============================================
   RESPONSIVO - TABLET (481px - 768px)
   ============================================ */
@media (max-width: 768px) {
    .layout-wrapper {
        flex-direction: column;
    }

    .sidebar {
        display: none;
    }

    .navbar-top {
        display: block;
    }

    .main-content {
        margin-top: 60px;
    }

    .main-content-inner {
        padding: 16px;
    }

    .page-title {
        font-size: 1.3rem;
    }

    .page-header {
        padding: 16px;
        margin-bottom: 16px;
    }

    .card-body {
        padding: 16px;
    }

    .table-scroll {
        max-height: 400px;
    }

    .table {
        min-width: 600px;
        font-size: 0.85rem;
    }

    .table th {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .table td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

    .btn-sm {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    .table-actions {
        flex-direction: column;
        gap: 4px;
    }
}

/* ============================================
   RESPONSIVO - MOBILE (≤480px)
   ============================================ */
@media (max-width: 480px) {
    .layout-wrapper {
        flex-direction: column;
    }

    .sidebar {
        display: none;
    }

    .navbar-top {
        display: block;
    }

    .main-content {
        margin-top: 60px;
    }

    .main-content-inner {
        padding: 12px;
    }

    .page-title {
        font-size: 1.1rem;
    }

    .page-header {
        padding: 12px;
        margin-bottom: 12px;
    }

    .card {
        margin-bottom: 12px;
    }

    .card-header {
        padding: 14px;
        font-size: 0.95rem;
    }

    .card-body {
        padding: 12px;
    }

    .form-group {
        margin-bottom: 14px;
    }

    .form-label {
        font-size: 0.85rem;
    }

    .form-control,
    .form-select {
        padding: 8px 10px;
        font-size: 0.85rem;
    }

    .btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .btn-sm {
        padding: 4px 8px;
        font-size: 0.7rem;
    }

    .table-scroll {
        max-height: 350px;
    }

    .table {
        min-width: 500px;
        font-size: 0.75rem;
    }

    .table th {
        padding: 8px 10px;
        font-size: 0.75rem;
    }

    .table td {
        padding: 8px 10px;
        font-size: 0.75rem;
    }

    .table-actions {
        flex-direction: column;
        gap: 2px;
    }

    .mobile-menu-header {
        padding: 12px;
    }

    .mobile-menu-nav a {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .mobile-menu-actions {
        padding: 8px;
        gap: 6px;
    }

    .mobile-menu-actions a {
        padding: 8px;
        font-size: 0.8rem;
    }
}
