/* =====================================================
   SIRAMAC - Sistema de Regulação e Acompanhamento
   de Medicamentos de Alto Custo
   Professional Healthcare/Government CSS
   ===================================================== */

/* ---- Variables ---- */
:root {
    --primary: #1565C0;
    --primary-dark: #0d47a1;
    --primary-light: #1976D2;
    --sidebar-bg: #0d2137;
    --sidebar-text: rgba(255, 255, 255, 0.75);
    --sidebar-active: rgba(255, 255, 255, 0.12);
    --accent-green: #2e7d32;
    --topbar-height: 65px;
    --sidebar-width: 260px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.15);
    --border-radius: 10px;
    --transition: all 0.25s ease;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font);
    background: #f0f4f8;
    color: #2d3748;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

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

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    overflow-y: auto;
    transition: var(--transition);
    box-shadow: 3px 0 15px rgba(0, 0, 0, 0.2);
}

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 20px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 72px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(21, 101, 192, 0.4);
}

.brand-text {
    margin-left: 12px;
}

.brand-name {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 1px;
    line-height: 1;
}

.brand-sub {
    display: block;
    font-size: 0.62rem;
    opacity: 0.55;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 3px;
    line-height: 1.3;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.3);
    padding: 0 12px;
    margin-bottom: 6px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--sidebar-text);
    font-size: 0.87rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transform: translateX(2px);
}

.sidebar-nav .nav-link.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(21, 101, 192, 0.35);
}

.sidebar-nav .nav-link i {
    width: 20px;
    font-size: 0.9rem;
    opacity: 0.8;
}

.sidebar-nav .nav-link.active i { opacity: 1; }

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-unit {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: var(--transition);
    flex-shrink: 0;
    font-size: 0.9rem;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #ef4444;
}

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

/* ---- Topbar ---- */
.topbar {
    background: #fff;
    height: var(--topbar-height);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.page-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 2px;
}

.breadcrumb {
    font-size: 0.75rem;
    margin-bottom: 0;
}

.breadcrumb-item a {
    color: var(--primary);
    text-decoration: none;
}

/* ---- Content Area ---- */
.content-area {
    padding: 24px;
    flex: 1;
}

/* ---- Cards ---- */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 0;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 14px 20px;
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* ---- Welcome Banner ---- */
.welcome-banner {
    background: linear-gradient(135deg, #1565C0 0%, #0d47a1 100%);
    color: #fff;
    padding: 20px 24px;
    border-radius: var(--border-radius);
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(21, 101, 192, 0.3);
}

.welcome-banner .btn {
    flex-shrink: 0;
}

/* ---- Stats Cards ---- */
.stat-card {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 18px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
    border: 1px solid #e8eef5;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin: 0 auto 10px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.75rem;
    color: #718096;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Soft background colors for stat icons */
.bg-primary-soft { background: rgba(21, 101, 192, 0.1); }
.bg-success-soft { background: rgba(46, 125, 50, 0.1); }
.bg-danger-soft { background: rgba(198, 40, 40, 0.1); }
.bg-warning-soft { background: rgba(245, 158, 11, 0.1); }
.bg-info-soft { background: rgba(2, 132, 199, 0.1); }
.bg-secondary-soft { background: rgba(107, 114, 128, 0.1); }

/* ---- Status Badges ---- */
.badge {
    font-size: 0.75rem;
    padding: 5px 10px;
    border-radius: 20px;
    font-weight: 600;
}

/* ---- Tables ---- */
.table th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
}

.table td {
    vertical-align: middle;
    color: #2d3748;
}

.table-hover tbody tr:hover {
    background: #f7fafc;
}

/* Row status colors in evaluation list */
.row-pendente { background: rgba(245, 158, 11, 0.04); }
.row-pendente:hover { background: rgba(245, 158, 11, 0.08) !important; }
.row-analise { background: rgba(2, 132, 199, 0.04); }
.row-analise:hover { background: rgba(2, 132, 199, 0.08) !important; }

/* ---- Forms ---- */
.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #4a5568;
    margin-bottom: 6px;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    font-size: 0.9rem;
    padding: 9px 14px;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
    outline: none;
}

.form-control::placeholder { color: #a0aec0; }

.input-group-text {
    background: #f7fafc;
    border: 1.5px solid #e2e8f0;
    color: #718096;
}

/* ---- Buttons ---- */
.btn {
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.87rem;
    transition: var(--transition);
    padding: 8px 18px;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(21, 101, 192, 0.3);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 1rem;
    border-radius: 10px;
}

/* ---- Timeline ---- */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 5px;
    bottom: 5px;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
}

.timeline-item:last-child { margin-bottom: 0; }

.timeline-marker {
    position: absolute;
    left: -25px;
    top: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #e2e8f0;
    z-index: 1;
}

.timeline-content {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
}

/* ---- Profile Avatar ---- */
.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(21, 101, 192, 0.3);
}

/* ---- Report Cards ---- */
.report-card {
    border: 2px solid #e2e8f0;
    border-radius: var(--border-radius);
    transition: var(--transition);
    cursor: pointer;
    color: inherit;
}

.report-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(21, 101, 192, 0.15);
}

/* ---- Alerts ---- */
.alert {
    border-radius: var(--border-radius);
    border: none;
    padding: 14px 18px;
    font-size: 0.9rem;
}

.alert-success { background: #f0fdf4; color: #166534; border-left: 4px solid #22c55e; }
.alert-danger { background: #fef2f2; color: #991b1b; border-left: 4px solid #ef4444; }
.alert-warning { background: #fffbeb; color: #92400e; border-left: 4px solid #f59e0b; }
.alert-info { background: #eff6ff; color: #1e40af; border-left: 4px solid #3b82f6; }
.alert-secondary { background: #f8fafc; color: #374151; border-left: 4px solid #6b7280; }

/* ---- Pagination ---- */
.page-link {
    border-radius: 6px !important;
    margin: 0 2px;
    color: var(--primary);
    border: 1px solid #e2e8f0;
    font-size: 0.85rem;
}

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}

/* ---- Mobile sidebar toggle ---- */
.sidebar-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    padding: 0;
    box-shadow: var(--shadow-lg);
}

/* ---- Miscellaneous ---- */
code {
    background: #eff3ff;
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Sticky filter bar */
.sticky-filters {
    position: sticky;
    top: var(--topbar-height);
    z-index: 50;
    background: #f0f4f8;
    padding-top: 8px;
    margin-top: -8px;
}

/* =====================================================
   PRINT STYLES
   ===================================================== */
@media print {
    .no-print,
    .sidebar,
    .topbar,
    .sidebar-toggle,
    .btn,
    nav.breadcrumb,
    .alert-dismissible .btn-close {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .content-area {
        padding: 0 !important;
    }

    body {
        background: #fff !important;
        font-size: 11pt;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
    }

    .stat-card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }

    .table {
        font-size: 10pt;
    }

    .badge {
        border: 1px solid #999 !important;
        color: #000 !important;
        background: none !important;
    }

    .print-header {
        display: block !important;
    }

    a { color: #000 !important; text-decoration: none !important; }

    @page {
        margin: 1.5cm;
    }
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content {
        margin-left: 0;
    }

    .topbar {
        padding: 0 16px;
    }

    .content-area {
        padding: 16px;
    }

    .welcome-banner {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .stat-value {
        font-size: 1.4rem;
    }

    .sidebar-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
}

@media (min-width: 769px) {
    .sidebar-toggle {
        display: none !important;
    }
}
