:root {
    --cj-blue: #1565C0;
    --cj-blue-dark: #0D47A1;
    --cj-blue-light: #42A5F5;
    --cj-green: #2E7D32;
    --cj-green-light: #4CAF50;
    --cj-yellow: #FBC02D;
    --cj-red: #E53935;
    --cj-bg: #F5F7FA;
    --cj-sidebar: #0D47A1;
    --cj-text: #212121;
    --cj-text-light: #757575;
    --cj-white: #FFFFFF;
    --cj-border: #E0E0E0;
    --cj-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    background: var(--cj-bg);
    color: var(--cj-text);
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, var(--cj-sidebar) 0%, #1565C0 100%);
    color: white;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s;
}

.sidebar-brand {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.sidebar-brand h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    letter-spacing: 1px;
}

.sidebar-brand small {
    font-size: 12px;
    opacity: 0.7;
    display: block;
    margin-top: 4px;
}

.sidebar-nav {
    padding: 16px 0;
}

.sidebar-nav .nav-item {
    margin: 4px 12px;
}

.sidebar-nav .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    text-decoration: none;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

.sidebar-nav .nav-link.active {
    background: rgba(255,255,255,0.2);
    color: white;
    font-weight: 600;
}

.sidebar-nav .nav-link i {
    font-size: 22px;
    width: 28px;
    text-align: center;
}

.sidebar-user {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.1);
}

.sidebar-user .user-name {
    font-weight: 600;
    font-size: 14px;
}

.sidebar-user .btn-logout {
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sidebar-user .btn-logout:hover {
    color: white;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 260px;
    padding: 24px 32px;
    min-height: 100vh;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--cj-blue-dark);
    margin: 0;
}

/* ===== CARDS ===== */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--cj-shadow);
    background: var(--cj-white);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--cj-border);
    font-weight: 600;
    font-size: 16px;
    padding: 16px 20px;
}

.card-body {
    padding: 20px;
}

.stat-card {
    border-left: 4px solid var(--cj-blue);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card .stat-number {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 14px;
    color: var(--cj-text-light);
    margin-top: 4px;
}

.stat-card.green { border-left-color: var(--cj-green); }
.stat-card.yellow { border-left-color: var(--cj-yellow); }
.stat-card.red { border-left-color: var(--cj-red); }

/* ===== BUTTONS 3D ===== */
.btn {
    font-size: 16px;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    position: relative;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    transform: translateY(0);
    text-shadow: 0 1px 1px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(4px);
}

.btn-lg {
    font-size: 18px;
    padding: 16px 32px;
    min-height: 56px;
}

.btn-xl {
    font-size: 20px;
    padding: 20px 40px;
    min-height: 64px;
    border-radius: 14px;
}

.btn-primary {
    background: linear-gradient(180deg, #42A5F5 0%, var(--cj-blue) 50%, #0D47A1 100%);
    box-shadow: 0 6px 0 #0A3A7A, 0 8px 12px rgba(13,71,161,0.3);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(180deg, #64B5F6 0%, #1976D2 50%, #0D47A1 100%);
    box-shadow: 0 6px 0 #0A3A7A, 0 10px 16px rgba(13,71,161,0.35);
    color: white;
    transform: translateY(-1px);
}

.btn-primary:active {
    box-shadow: 0 2px 0 #0A3A7A, 0 3px 6px rgba(13,71,161,0.3);
    transform: translateY(4px);
}

.btn-success {
    background: linear-gradient(180deg, #66BB6A 0%, var(--cj-green) 50%, #1B5E20 100%);
    box-shadow: 0 6px 0 #145218, 0 8px 12px rgba(27,94,32,0.3);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(180deg, #81C784 0%, #388E3C 50%, #1B5E20 100%);
    box-shadow: 0 6px 0 #145218, 0 10px 16px rgba(27,94,32,0.35);
    color: white;
    transform: translateY(-1px);
}

.btn-success:active {
    box-shadow: 0 2px 0 #145218, 0 3px 6px rgba(27,94,32,0.3);
    transform: translateY(4px);
}

.btn-warning {
    background: linear-gradient(180deg, #FFEE58 0%, var(--cj-yellow) 50%, #F9A825 100%);
    box-shadow: 0 6px 0 #E68A00, 0 8px 12px rgba(230,138,0,0.3);
    color: #212121;
    text-shadow: none;
}

.btn-warning:hover {
    background: linear-gradient(180deg, #FFF176 0%, #FFD54F 50%, #F9A825 100%);
    box-shadow: 0 6px 0 #E68A00, 0 10px 16px rgba(230,138,0,0.35);
    color: #212121;
    transform: translateY(-1px);
}

.btn-warning:active {
    box-shadow: 0 2px 0 #E68A00, 0 3px 6px rgba(230,138,0,0.3);
    transform: translateY(4px);
}

.btn-danger {
    background: linear-gradient(180deg, #EF5350 0%, var(--cj-red) 50%, #B71C1C 100%);
    box-shadow: 0 6px 0 #8B1515, 0 8px 12px rgba(183,28,28,0.3);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(180deg, #E57373 0%, #D32F2F 50%, #B71C1C 100%);
    box-shadow: 0 6px 0 #8B1515, 0 10px 16px rgba(183,28,28,0.35);
    color: white;
    transform: translateY(-1px);
}

.btn-danger:active {
    box-shadow: 0 2px 0 #8B1515, 0 3px 6px rgba(183,28,28,0.3);
    transform: translateY(4px);
}

.btn-outline-primary {
    background: white;
    border: 2px solid var(--cj-blue);
    color: var(--cj-blue);
    box-shadow: 0 4px 0 #B0BEC5, 0 5px 8px rgba(0,0,0,0.1);
    text-shadow: none;
}

.btn-outline-primary:hover {
    background: rgba(21,101,192,0.06);
    color: var(--cj-blue-dark);
    border-color: var(--cj-blue-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 0 #B0BEC5, 0 6px 10px rgba(0,0,0,0.12);
}

.btn-outline-primary:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #B0BEC5;
}

.btn-outline-secondary {
    background: white;
    border: 2px solid #90A4AE;
    color: #546E7A;
    box-shadow: 0 4px 0 #B0BEC5, 0 5px 8px rgba(0,0,0,0.08);
    text-shadow: none;
}

.btn-outline-secondary:hover {
    background: #F5F5F5;
    color: #37474F;
    transform: translateY(-1px);
    box-shadow: 0 4px 0 #B0BEC5, 0 6px 10px rgba(0,0,0,0.1);
}

.btn-outline-secondary:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #B0BEC5;
}

.btn-outline-success {
    background: white;
    border: 2px solid var(--cj-green);
    color: var(--cj-green);
    box-shadow: 0 4px 0 #B0BEC5, 0 5px 8px rgba(0,0,0,0.08);
    text-shadow: none;
}

.btn-outline-success:hover {
    background: rgba(46,125,50,0.06);
    transform: translateY(-1px);
}

.btn-outline-success:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #B0BEC5;
}

.btn-action {
    width: 100%;
    justify-content: center;
}

.btn-sm {
    font-size: 13px;
    padding: 6px 14px;
    min-height: 34px;
    box-shadow: 0 3px 0 rgba(0,0,0,0.15), 0 4px 6px rgba(0,0,0,0.08);
}

.btn-sm:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}

/* ===== FORMS ===== */
.form-control, .form-select {
    font-size: 16px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 2px solid var(--cj-border);
    min-height: 48px;
    transition: border-color 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--cj-blue);
    box-shadow: 0 0 0 3px rgba(21,101,192,0.15);
}

.form-label {
    font-weight: 600;
    font-size: 15px;
    color: var(--cj-text);
    margin-bottom: 6px;
}

/* ===== UPLOAD ZONE ===== */
.upload-zone {
    border: 3px dashed var(--cj-blue-light);
    border-radius: 16px;
    padding: 60px 40px;
    text-align: center;
    background: rgba(21,101,192,0.03);
    cursor: pointer;
    transition: all 0.3s;
}

.upload-zone:hover, .upload-zone.dragover {
    background: rgba(21,101,192,0.08);
    border-color: var(--cj-blue);
}

.upload-zone i {
    font-size: 64px;
    color: var(--cj-blue-light);
    display: block;
    margin-bottom: 16px;
}

.upload-zone h3 {
    font-size: 20px;
    color: var(--cj-blue);
    margin-bottom: 8px;
}

.upload-zone p {
    color: var(--cj-text-light);
    font-size: 15px;
}

/* ===== VOICE RECORDING ===== */
.voice-btn {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--cj-red);
    border: 4px solid #C62828;
    color: white;
    font-size: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    margin: 0 auto;
}

.voice-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(229,57,53,0.4);
}

.voice-btn.recording {
    animation: pulse-recording 1.5s ease-in-out infinite;
    background: #C62828;
}

@keyframes pulse-recording {
    0% { box-shadow: 0 0 0 0 rgba(229,57,53,0.6); }
    70% { box-shadow: 0 0 0 20px rgba(229,57,53,0); }
    100% { box-shadow: 0 0 0 0 rgba(229,57,53,0); }
}

.voice-status {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    margin-top: 16px;
    min-height: 28px;
}

.voice-status.recording {
    color: var(--cj-red);
}

/* ===== TABLES ===== */
.table {
    font-size: 15px;
}

.table th {
    font-weight: 600;
    color: var(--cj-text-light);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--cj-border);
}

.table td {
    vertical-align: middle;
    padding: 14px 12px;
}

.table-hover tbody tr:hover {
    background: rgba(21,101,192,0.04);
    cursor: pointer;
}

/* ===== BADGES ===== */
.badge {
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
}

/* ===== PDF VIEWER ===== */
.pdf-viewer-container {
    border: 2px solid var(--cj-border);
    border-radius: 12px;
    overflow: hidden;
    background: #525659;
    min-height: 500px;
}

.pdf-viewer-container iframe {
    width: 100%;
    height: 600px;
    border: none;
}

/* ===== CERTIDAO PREVIEW ===== */
.certidao-preview {
    background: white;
    border: 2px solid var(--cj-border);
    border-radius: 12px;
    padding: 32px;
    font-family: 'Times New Roman', Georgia, serif;
    font-size: 15px;
    line-height: 1.8;
    max-height: 600px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

/* ===== FLOATING HELP BUTTON ===== */
.help-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--cj-green);
    color: white;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(46,125,50,0.4);
    cursor: pointer;
    z-index: 999;
    text-decoration: none;
    transition: all 0.3s;
}

.help-float:hover {
    transform: scale(1.1);
    background: #1B5E20;
    color: white;
}

/* ===== LOADING SPINNER ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    flex-direction: column;
    gap: 16px;
}

.loading-overlay .spinner-border {
    width: 60px;
    height: 60px;
    border-width: 5px;
}

.loading-overlay .loading-text {
    color: white;
    font-size: 20px;
    font-weight: 600;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--cj-blue-dark) 0%, var(--cj-green) 100%);
}

.login-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    width: 100%;
    max-width: 440px;
    padding: 48px 40px;
}

.login-card .brand {
    text-align: center;
    margin-bottom: 32px;
}

.login-card .brand h1 {
    font-size: 32px;
    font-weight: 800;
    color: var(--cj-blue-dark);
    margin: 0;
}

.login-card .brand p {
    color: var(--cj-text-light);
    font-size: 14px;
    margin-top: 4px;
}

.login-card .btn-primary {
    width: 100%;
    font-size: 18px;
    padding: 14px;
    margin-top: 8px;
}

/* ===== SEARCH BAR ===== */
.search-bar {
    position: relative;
}

.search-bar input {
    padding-left: 44px;
}

.search-bar i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cj-text-light);
    font-size: 18px;
}

/* ===== MOBILE TOP BAR ===== */
.mobile-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--cj-sidebar);
    color: white;
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 1001;
    gap: 12px;
}

.mobile-topbar .btn-menu {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    padding: 4px;
    line-height: 1;
}

.mobile-topbar .topbar-brand {
    font-size: 18px;
    font-weight: 700;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

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

/* ===== RESPONSIVE — MOBILE FIRST ===== */
@media (max-width: 767.98px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        padding: 72px 12px 24px 12px;
    }
    .page-header h1 {
        font-size: 22px;
    }
    .btn { font-size: 15px; padding: 12px 18px; }
    .btn-lg { font-size: 17px; padding: 14px 24px; }
    .btn-xl { font-size: 18px; padding: 16px 24px; }
    .voice-btn {
        width: 100px;
        height: 100px;
        font-size: 40px;
    }
    .upload-zone {
        padding: 40px 20px;
    }
    .upload-zone i { font-size: 48px; }
    .upload-zone h3 { font-size: 18px; }
    .card-body { padding: 16px; }
    .certidao-preview { padding: 20px; font-size: 14px; }
    .pdf-viewer-container iframe { height: 400px; }
    .login-card { margin: 16px; padding: 32px 24px; }
    .stat-card .stat-number { font-size: 28px; }
    .form-control, .form-select { font-size: 16px; }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 991.98px) {
    .sidebar { width: 220px; }
    .main-content { margin-left: 220px; padding: 20px; }
    .sidebar-nav .nav-link { font-size: 14px; padding: 12px 14px; }
}

/* ===== MANUAL ===== */
.manual-section .accordion-button {
    font-size: 18px;
    font-weight: 600;
    padding: 20px 24px;
}

.manual-section .accordion-body {
    font-size: 16px;
    line-height: 1.8;
    padding: 24px;
}

.manual-section .step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cj-blue);
    color: white;
    font-weight: 700;
    font-size: 16px;
    margin-right: 12px;
    flex-shrink: 0;
}

.manual-section .step {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--cj-bg);
    border-radius: 10px;
}

.manual-section .step-text {
    font-size: 16px;
    line-height: 1.6;
}
