/**
 * Central de Integridade - Main Stylesheet
 * Sistema de Gestão de Compliance
 */

/* ===== CSS Variables ===== */
:root {
    --primary-color: #1a5f7a;
    --primary-dark: #134b61;
    --primary-light: #2d7a9a;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    --white-color: #ffffff;
    
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    
    --border-color: #dee2e6;
    --border-radius: 0.375rem;
    --border-radius-lg: 0.5rem;
    
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --topbar-height: 60px;
    
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    
    --transition-speed: 0.3s;
}

/* ===== Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
    color: var(--text-primary);
    overflow-x: hidden;
}

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

a:hover {
    color: var(--primary-dark);
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    z-index: 1000;
    transition: all var(--transition-speed) ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

/* Sidebar collapsed - hide text elements */
.sidebar.collapsed .sidebar-header span,
.sidebar.collapsed .sidebar-header .logo-text,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 1.25rem 0.5rem;
}

.sidebar.collapsed .sidebar-nav .nav-item {
    margin: 0.15rem 0.5rem;
}

.sidebar.collapsed .sidebar-nav .nav-link {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .sidebar-nav .nav-link i {
    margin: 0;
    font-size: 1.25rem;
}

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .nav-link {
    position: relative;
}

.sidebar.collapsed .nav-link::after {
    content: attr(data-title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--dark-color);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    margin-left: 0.5rem;
    z-index: 1001;
    pointer-events: none;
}

.sidebar.collapsed .nav-link:hover::after {
    opacity: 1;
    visibility: visible;
}

.sidebar-header {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
    font-size: 1.1rem;
    white-space: nowrap;
}

.sidebar-header i {
    font-size: 1.5rem;
}

.sidebar-nav {
    list-style: none;
    padding: 1rem 0;
}

.sidebar-nav .nav-section {
    padding: 0.75rem 1.25rem 0.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
}

.sidebar-nav .nav-item {
    margin: 0.15rem 0.75rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    color: rgba(255, 255, 255, 0.85);
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
    white-space: nowrap;
}

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

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

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

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

.sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* ===== Top Navbar ===== */
.top-navbar {
    background: white;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-toggle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
}

.sidebar-toggle:hover {
    color: var(--primary-color);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-dropdown {
    color: var(--text-primary);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
}

.user-dropdown:hover {
    background: var(--light-color);
    color: var(--primary-color);
}

/* ===== Content Wrapper ===== */
.content-wrapper {
    flex: 1;
    padding: 1.5rem;
}

/* ===== Page Header ===== */
.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

/* ===== Cards ===== */
.card {
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    background: white;
}

.card-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

/* ===== Stat Cards ===== */
.stat-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

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

.stat-card-primary {
    border-left: 4px solid var(--primary-color);
}

.stat-card-success {
    border-left: 4px solid var(--success-color);
}

.stat-card-warning {
    border-left: 4px solid var(--warning-color);
}

.stat-card-danger {
    border-left: 4px solid var(--danger-color);
}

.stat-card-info {
    border-left: 4px solid var(--info-color);
}

.stat-card-secondary {
    border-left: 4px solid var(--secondary-color);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--light-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.stat-content h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0;
    line-height: 1;
}

.stat-content p {
    margin-bottom: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== Phases Timeline ===== */
.phases-timeline {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.phase-item {
    flex: 1;
    min-width: 150px;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--light-color);
    border-radius: var(--border-radius);
    border-left: 3px solid var(--border-color);
}

.phase-item.completed {
    border-left-color: var(--success-color);
    background: rgba(25, 135, 84, 0.05);
}

.phase-item.in-progress {
    border-left-color: var(--primary-color);
    background: rgba(26, 95, 122, 0.05);
}

.phase-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.phase-card {
    padding: 1rem;
    background: var(--light-color);
    border-radius: var(--border-radius);
    border-left: 3px solid var(--border-color);
    height: 100%;
}

.phase-card.completed {
    border-left-color: var(--success-color);
    background: rgba(25, 135, 84, 0.05);
}

.phase-card.in-progress {
    border-left-color: var(--primary-color);
    background: rgba(26, 95, 122, 0.05);
}

.phase-card h6 {
    font-size: 0.85rem;
    margin-bottom: 0;
    line-height: 1.3;
}

.phase-content h6 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.phase-content small {
    font-size: 0.75rem;
}

/* ===== Risk Summary ===== */
.risk-summary {
    display: flex;
    justify-content: space-around;
    text-align: center;
}

.risk-level {
    padding: 1rem;
}

.risk-count {
    display: block;
    font-size: 2rem;
    font-weight: 700;
}

.risk-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.risk-critical .risk-count { color: var(--danger-color); }
.risk-high .risk-count { color: #fd7e14; }
.risk-medium .risk-count { color: var(--warning-color); }
.risk-low .risk-count { color: var(--success-color); }

/* ===== Task Summary ===== */
.task-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.task-stat {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.task-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.task-stat-info h4 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0;
}

.task-stat-info span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===== ISO Cards ===== */
.iso-card {
    text-align: center;
    padding: 1rem;
    background: var(--light-color);
    border-radius: var(--border-radius);
}

.iso-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.iso-name {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== Stat Box ===== */
.stat-box {
    padding: 1rem;
    border-radius: var(--border-radius);
}

.stat-box h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0;
}

/* ===== Risk Matrix ===== */
.risk-matrix-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.matrix-y-label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
}

.matrix-wrapper {
    flex: 1;
}

.risk-matrix {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.risk-matrix th,
.risk-matrix td {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    text-align: center;
    vertical-align: middle;
}

.risk-matrix thead th {
    background: var(--light-color);
    font-weight: 600;
    font-size: 0.85rem;
}

.risk-matrix thead th small {
    display: block;
    font-weight: normal;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.risk-matrix tbody th {
    background: var(--light-color);
    font-weight: 600;
    font-size: 0.85rem;
    width: 100px;
}

.risk-matrix tbody th small {
    display: block;
    font-weight: normal;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.matrix-cell {
    height: 80px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.matrix-cell:hover {
    transform: scale(1.05);
    z-index: 10;
    box-shadow: var(--shadow);
}

.cell-low { background: rgba(25, 135, 84, 0.2); }
.cell-medium { background: rgba(255, 193, 7, 0.3); }
.cell-high { background: rgba(253, 126, 20, 0.4); }
.cell-critical { background: rgba(220, 53, 69, 0.4); }

.cell-score {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.cell-risks {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    justify-content: center;
    margin-top: 1rem;
}

.risk-dot {
    color: var(--dark-color);
    font-size: 0.5rem;
}

.cell-count {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.matrix-x-label {
    text-align: center;
    margin-top: 0.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
}

/* ===== Kanban Board ===== */
.kanban-board {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.kanban-column {
    flex: 0 0 280px;
    background: var(--light-color);
    border-radius: var(--border-radius-lg);
    display: flex;
    flex-direction: column;
}

.kanban-header {
    padding: 1rem;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.kanban-header h6 {
    margin: 0;
    display: flex;
    align-items: center;
}

.kanban-body {
    flex: 1;
    padding: 0.75rem;
    min-height: 300px;
    max-height: 600px;
    overflow-y: auto;
}

.kanban-body.drag-over {
    background: rgba(26, 95, 122, 0.1);
}

.kanban-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    position: relative;
    transition: all 0.2s ease;
}

.kanban-card:hover {
    box-shadow: var(--shadow);
}

.kanban-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.kanban-card.completed {
    opacity: 0.7;
}

.kanban-card-header {
    margin-bottom: 0.5rem;
}

.kanban-card-title {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.kanban-card-footer {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

/* ===== Tables ===== */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
}

.table td {
    vertical-align: middle;
}

/* ===== Forms ===== */
.form-label {
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.375rem;
}

.form-control,
.form-select {
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(26, 95, 122, 0.15);
}

/* ===== Buttons ===== */
.btn {
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

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

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

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

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

/* ===== Pagination Component ===== */
.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--light-color);
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

.pagination-info {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.pagination-info strong {
    color: var(--text-primary);
    font-weight: 600;
}

.pagination-modern {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 4px;
}

.pagination-modern .page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--white-color);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
}

.pagination-modern .page-item .page-link:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white-color);
}

.pagination-modern .page-item.active .page-link {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white-color);
    box-shadow: 0 2px 6px rgba(26, 95, 122, 0.3);
}

.pagination-modern .page-item.disabled .page-link {
    background: var(--light-color);
    border-color: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
    pointer-events: none;
}

.pagination-modern .page-item .page-link.dots {
    border: none;
    background: transparent;
    cursor: default;
    color: var(--text-muted);
    min-width: 24px;
}

.pagination-modern .page-item .page-link.dots:hover {
    background: transparent;
    color: var(--text-muted);
}

@media (max-width: 576px) {
    .pagination-wrapper {
        justify-content: center;
        flex-direction: column;
        text-align: center;
    }
}

/* ===== Badges ===== */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

.bg-orange {
    background-color: #fd7e14 !important;
    color: white;
}

.border-orange {
    border-color: #fd7e14 !important;
}

/* ===== Alerts ===== */
.alert {
    border: none;
    border-radius: var(--border-radius);
}

/* ===== Footer ===== */
.footer {
    background: white;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .task-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .kanban-column {
        flex: 0 0 260px;
    }
}

@media (max-width: 575.98px) {
    .content-wrapper {
        padding: 1rem;
    }
    
    .page-title {
        font-size: 1.25rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-content h3 {
        font-size: 1.5rem;
    }
    
    .phases-timeline {
        flex-direction: column;
    }
    
    .phase-item {
        min-width: 100%;
    }
}

/* ===== Utilities ===== */
.text-orange {
    color: #fd7e14 !important;
}

.bg-success-subtle {
    background-color: rgba(25, 135, 84, 0.1) !important;
}

.bg-warning-subtle {
    background-color: rgba(255, 193, 7, 0.15) !important;
}

.bg-danger-subtle {
    background-color: rgba(220, 53, 69, 0.1) !important;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== Print ===== */
@media print {
    .sidebar,
    .top-navbar,
    .footer {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}
