/* ============================================================
   PMN Chamados - Estilos do Sistema
   ============================================================ */

:root {
    --sidebar-width: 260px;
    --sidebar-collapsed: 0px;
    --primary-color: #1e3a5f;
    --primary-light: #2d5f8a;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #2d5f8a;
    --header-height: 56px;
}

/* Layout principal */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f1f5f9;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1040;
    transition: transform 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    text-decoration: none;
    flex-shrink: 0;
}

.sidebar-brand i {
    font-size: 1.5rem;
    color: #60a5fa;
}

.sidebar-brand span {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0;
}

.sidebar-nav .nav-section {
    padding: 0.75rem 1.25rem 0.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    font-weight: 600;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
}

.sidebar-nav .nav-link.active {
    background: rgba(45, 95, 138, 0.3);
    color: #60a5fa;
    border-left-color: #60a5fa;
}

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

/* Conteúdo principal */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* Header */
.top-header {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.top-header .btn-toggle-sidebar {
    display: none;
    border: none;
    background: none;
    font-size: 1.25rem;
    color: #475569;
    cursor: pointer;
}

/* Busca global */
.search-global {
    position: relative;
    max-width: 400px;
    flex: 1;
}

.search-global input {
    padding-left: 2.5rem;
    border-radius: 2rem;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 0.875rem;
}

.search-global input:focus {
    background: #fff;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(45, 95, 138, 0.1);
}

.search-global .search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1050;
}

.search-results-dropdown.show { display: block; }

.search-result-item {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #334155;
    font-size: 0.875rem;
}

.search-result-item:hover {
    background: #f8fafc;
    color: var(--primary-color);
}

/* Área de conteúdo */
.content-area {
    padding: 1.5rem;
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

/* Cards de estatísticas */
.stat-card {
    border: none;
    border-radius: 0.75rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: #64748b;
}

/* Tabelas */
.table-container {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    overflow: hidden;
}

.table-container .table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #475569;
    white-space: nowrap;
}

.table tbody td {
    vertical-align: middle;
    font-size: 0.875rem;
    color: #334155;
}

.table tbody tr:hover {
    background: #f8fafc;
}

/* Badges */
.badge { font-weight: 500; font-size: 0.75rem; }

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

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

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.35rem;
    top: 0.25rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #60a5fa;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #e2e8f0;
}

.timeline-item.event-manutencao::before { background: #f59e0b; }
.timeline-item.event-recarga::before { background: #10b981; }
.timeline-item.event-chamado::before { background: #3b82f6; }
.timeline-item.event-status::before { background: #8b5cf6; }
.timeline-item.event-instalacao::before { background: #06b6d4; }
.timeline-item.event-troca_peca::before { background: #ef4444; }

.timeline-date {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 0.25rem;
}

.timeline-content {
    font-size: 0.875rem;
    color: #334155;
}

/* Cards gerais */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* Formulários */
.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(45, 95, 138, 0.1);
}

/* Botões */
.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

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

/* Paginação */
.pagination .page-link {
    color: var(--primary-color);
    font-size: 0.875rem;
}

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

/* Footer dentro do sidebar */
.sidebar-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.sidebar-footer .user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #94a3b8;
    font-size: 0.8rem;
}

.sidebar-footer .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--sidebar-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #60a5fa;
    font-weight: 700;
    font-size: 0.9rem;
}

/* Responsivo - Tablet */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .top-header .btn-toggle-sidebar {
        display: block;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1035;
    }
    .sidebar-overlay.show {
        display: block;
    }
    .content-area {
        padding: 1rem;
    }
}

/* Responsivo - Mobile */
@media (max-width: 767.98px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .page-header .btn,
    .page-header .d-flex {
        width: 100%;
    }
    .table thead th {
        font-size: 0.7rem;
        padding: 0.5rem 0.4rem;
    }
    .table tbody td {
        font-size: 0.8rem;
        padding: 0.5rem 0.4rem;
    }
    .card-header {
        padding: 0.75rem;
    }
    .card-header h6 {
        font-size: 0.85rem;
    }
    .card-body {
        padding: 0.75rem;
    }
    /* Stat cards */
    .stat-card .card-body,
    .card.bg-light .card-body {
        padding: 0.6rem 0.4rem;
    }
    .stat-card .stat-value,
    .card.bg-light h3 {
        font-size: 1.25rem;
    }
    .stat-card .stat-label,
    .card.bg-light h6 {
        font-size: 0.7rem;
    }
    .card.bg-light i[style*="font-size: 2rem"] {
        font-size: 1.4rem !important;
    }
    /* Botões de ação responsivos */
    .btn-group .btn,
    .table .btn {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }
    /* Header ajuste */
    .top-header {
        padding: 0 0.75rem;
    }
    .dropdown-toggle span {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .content-area {
        padding: 0.75rem;
    }
    .page-header h1 {
        font-size: 1.15rem;
    }
    /* Formulários mobile */
    .form-control, .form-select {
        font-size: 0.875rem;
    }
    /* Cards menores */
    .card.bg-light .card-body {
        padding: 0.5rem 0.25rem;
    }
    .card.bg-light h3 {
        font-size: 1.1rem;
    }
    .card.bg-light h6 {
        font-size: 0.65rem;
    }
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    display: none;
}

/* Print */
@media print {
    .sidebar, .top-header, .btn, .pagination { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .content-area { padding: 0 !important; }
}
