/**
 * ═══════════════════════════════════════════════════════════════════════════
 * CMR JURÍDICO PRO - DESIGN SYSTEM COMPACTO
 * CSS OTIMIZADO - Tamanhos Compactos para Desktop
 * ═══════════════════════════════════════════════════════════════════════════
 */

:root {
    /* ═══════════ PALETA DE CORES ═══════════ */
    --primary-gold: #d4af37;
    --gold-light: #f4d03f;
    --gold-dark: #b8941e;
    
    --bg-primary: #0a0a0a;
    --bg-secondary: #151515;
    --bg-tertiary: #1f1f1f;
    --bg-card: #1a1a1a;
    
    --gray-100: #f5f5f5;
    --gray-200: #e5e5e5;
    --gray-300: #d4d4d4;
    --gray-400: #a3a3a3;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-700: #404040;
    --gray-800: #262626;
    --gray-900: #171717;
    
    --beige-light: #f5f1e8;
    --beige: #e8dcc4;
    --beige-dark: #d4c5a0;
    
    --border-color: rgba(212, 175, 55, 0.15);
    --border-hover: rgba(212, 175, 55, 0.4);
    
    --text-primary: #ffffff;
    --text-secondary: #d1d1d1;
    --text-muted: #a3a3a3;
    --text-gold: #d4af37;
    
    --gold-gradient: linear-gradient(135deg, #d4af37 0%, #f4d03f 100%);
    --dark-gradient: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* RESET E BASE */
/* ═══════════════════════════════════════════════════════════════════════════ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 13px;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: 200px;
    min-height: 100vh;
}

.content {
    flex: 1;
    padding: 20px 24px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* SIDEBAR - COMPACTA */
/* ═══════════════════════════════════════════════════════════════════════════ */

.sidebar {
    width: 200px;
    background: var(--dark-gradient);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--gray-700);
    border-radius: 3px;
}

.sidebar-header {
    padding: 16px 14px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gold-gradient);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #0a0a0a;
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.4);
    flex-shrink: 0;
}

.sidebar-logo-text {
    font-size: 15px;
    font-weight: 800;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.sidebar-logo-text span {
    display: block;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 14px 0;
}

.nav-section {
    margin-bottom: 18px;
}

.nav-section-title {
    color: var(--text-muted);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 10px 14px 6px;
    font-weight: 700;
}

.nav-item {
    padding: 8px 14px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    font-size: 12px;
    font-weight: 500;
}

.nav-item i {
    width: 16px;
    text-align: center;
    font-size: 14px;
}

.nav-item:hover {
    background: rgba(212, 175, 55, 0.08);
    color: var(--text-gold);
}

.nav-item.active {
    background: rgba(212, 175, 55, 0.12);
    color: var(--primary-gold);
    border-left-color: var(--primary-gold);
    font-weight: 600;
}

.nav-item .badge {
    margin-left: auto;
    padding: 2px 6px;
    font-size: 9px;
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding: 14px 0;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* HEADER - COMPACTO */
/* ═══════════════════════════════════════════════════════════════════════════ */

.header {
    background: linear-gradient(135deg, #1a1a1a 0%, #262626 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 60px;
}

.page-title {
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    font-size: 22px;
    letter-spacing: -0.5px;
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-icon {
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid var(--border-color);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    color: var(--text-secondary);
    font-size: 16px;
}

.btn-icon:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: var(--primary-gold);
    color: var(--primary-gold);
}

.btn-icon .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--gold-gradient);
    color: #0a0a0a;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: rgba(212, 175, 55, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    transition: all 0.3s;
    cursor: pointer;
}

.header-user:hover {
    background: rgba(212, 175, 55, 0.15);
}

.header-user span {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 12px;
}

.header-user i {
    color: var(--primary-gold);
    font-size: 20px;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* DASHBOARD CARDS - COMPACTOS */
/* ═══════════════════════════════════════════════════════════════════════════ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
    transition: all 0.3s;
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.stat-icon {
    width: 42px;
    height: 42px;
    background: rgba(212, 175, 55, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--primary-gold);
    margin-bottom: 12px;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* CARDS - COMPACTOS */
/* ═══════════════════════════════════════════════════════════════════════════ */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.card-title i {
    color: var(--primary-gold);
    font-size: 18px;
}

.card-body {
    padding: 20px;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* BOTÕES - COMPACTOS */
/* ═══════════════════════════════════════════════════════════════════════════ */

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    white-space: nowrap;
}

.btn i {
    font-size: 13px;
}

.btn-primary {
    background: var(--gold-gradient);
    color: #0a0a0a;
    box-shadow: 0 2px 12px rgba(212, 175, 55, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.5);
}

.btn-secondary {
    background: var(--gray-700);
    color: var(--text-primary);
    border: 1px solid var(--gray-600);
}

.btn-secondary:hover {
    background: var(--gray-600);
}

.btn-success {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
    box-shadow: 0 2px 12px rgba(46, 204, 113, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    box-shadow: 0 2px 12px rgba(231, 76, 60, 0.3);
}

.btn-info {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    box-shadow: 0 2px 12px rgba(52, 152, 219, 0.3);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 11px;
}

.btn-lg {
    padding: 10px 20px;
    font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* FORMS - COMPACTOS */
/* ═══════════════════════════════════════════════════════════════════════════ */

.form-group {
    margin-bottom: 16px;
}

.form-label {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
}

.form-control {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s;
    font-size: 12px;
    font-family: inherit;
}

.form-control:focus {
    background: var(--bg-card);
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
    outline: none;
}

.form-control::placeholder {
    color: var(--gray-500);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a3a3a3' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* TABELAS - COMPACTAS */
/* ═══════════════════════════════════════════════════════════════════════════ */

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 12px;
}

.table tr:hover {
    background: rgba(212, 175, 55, 0.05);
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* MODAL - COMPACTO */
/* ═══════════════════════════════════════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    transition: all 0.3s;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--primary-gold);
    transform: rotate(90deg);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* BADGES - COMPACTOS */
/* ═══════════════════════════════════════════════════════════════════════════ */

.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.badge-success {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
}

.badge-warning {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
}

.badge-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.badge-info {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.badge-secondary {
    background: var(--gray-700);
    color: white;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* ALERT - COMPACTO */
/* ═══════════════════════════════════════════════════════════════════════════ */

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

.alert i {
    font-size: 16px;
}

.alert-info {
    background: rgba(52, 152, 219, 0.1);
    border: 1px solid rgba(52, 152, 219, 0.3);
    color: #3498db;
}

.alert-success {
    background: rgba(46, 204, 113, 0.1);
    border: 1px solid rgba(46, 204, 113, 0.3);
    color: #2ecc71;
}

.alert-warning {
    background: rgba(243, 156, 18, 0.1);
    border: 1px solid rgba(243, 156, 18, 0.3);
    color: #f39c12;
}

.alert-danger {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #e74c3c;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* UTILIDADES */
/* ═══════════════════════════════════════════════════════════════════════════ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }
.p-4 { padding: 32px; }

.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

/* ═══════════════════════════════════════════════════════════════════════════ */
/* RESPONSIVO */
/* ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1400px) {
    .content {
        max-width: 100%;
    }
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .header {
        margin-left: 0;
    }
    
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .content {
        padding: 16px;
    }
    
    .header {
        padding: 12px 16px;
        min-height: 54px;
    }
    
    .page-title {
        font-size: 18px;
    }
    
    .card-header,
    .card-body,
    .modal-body {
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 14px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* ANIMAÇÕES */
/* ═══════════════════════════════════════════════════════════════════════════ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.fade-in-up {
    animation: fadeInUp 0.4s ease-out;
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* SCROLLBAR PERSONALIZADO */
/* ═══════════════════════════════════════════════════════════════════════════ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-700);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-600);
}