/**
 * Estilos CSS Personalizados
 * 
 * Complementa Bootstrap 5 com estilos customizados
 * Responsivo e limpo
 */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
}

/* Geral */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Cards */
.card {
    border-radius: 8px;
    transition: box-shadow 0.2s ease;
    border: none;
}

.card:hover {
    /* Removido movimento no hover para evitar deslocamento */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15) !important;
}

/* Sombra 3D para cards (login, register, etc) */
.card-3d {
    box-shadow: 
        0 20px 60px rgba(102, 126, 234, 0.2),
        0 10px 30px rgba(118, 75, 162, 0.15),
        0 5px 15px rgba(0, 0, 0, 0.1) !important;
    border: none !important;
    transition: box-shadow 0.3s ease;
}

.card-3d:hover {
    /* Removido movimento excessivo no hover */
    box-shadow: 
        0 30px 80px rgba(102, 126, 234, 0.25),
        0 15px 40px rgba(118, 75, 162, 0.2),
        0 8px 20px rgba(0, 0, 0, 0.15) !important;
}

.card-title {
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Buttons */
.btn {
    border-radius: 6px;
    border: none;
    font-weight: 500;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
    padding: 0.4rem 1.2rem;
    height: 38px;
    width: 150px;
}

.btn-primary {
    background-color: #007278;
}

/* Botão editar específico */
.btn-edit {
    background-color: #1DA466;
    border-color: #1DA466;
    color: #fff;
}
.btn-edit:hover {
    background-color: #178f52;
    border-color: #178f52;
}

.btn-primary:hover {
    background-color: #007278;
}

.btn-danger:hover {
    background-color: #c82333;
}

/* Forms */
.form-control,
.form-select {
    border-radius: 6px;
    border: 1px solid #dee2e6;
    padding: 0.5rem 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    height: calc(2.25rem + 2px);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-label {
    font-weight: 500;
    color: #212529;
    margin-bottom: 0.5rem;
}

/* Alerts */
.alert {
    border-radius: 6px;
    border: none;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background-color: #d1f2d9;
    color: #155724;
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid var(--danger-color);
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid var(--info-color);
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid var(--warning-color);
}

/* Navbar */
.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: #263E5A !important;
}

.navbar-brand {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-link {
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--primary-color) !important;
}

/* Footer */
footer {
    margin-top: auto;
    border-top: 1px solid #dee2e6;
}

/* Container */
.container,
.container-fluid {
    max-width: 100%;
}

/* Responsivo */
@media (max-width: 768px) {
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .card {
        margin-bottom: 1rem;
    }

    h1 {
        font-size: 1.8rem !important;
    }

    h2 {
        font-size: 1.5rem !important;
    }

    h3 {
        font-size: 1.3rem !important;
    }
}

/* Utilitários */
.text-muted {
    color: #6c757d !important;
}

.shadow-sm {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.shadow {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
}

/* Animações */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Indicadores */
.indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.indicator-success {
    background-color: var(--success-color);
}

.indicator-danger {
    background-color: var(--danger-color);
}

.indicator-warning {
    background-color: var(--warning-color);
}

.indicator-info {
    background-color: var(--info-color);
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    left: 0;
    top: 56px; /* Altura da navbar */
    height: calc(100vh - 56px);
    width: 220px;
    background: #263E5A;
    color: #fff;
    overflow-y: auto;
    padding: 20px 0;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    margin-bottom: 30px;
    font-size: 1.1rem;
    font-weight: 600;
}

.sidebar-header h5 {
    color: #fff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header .btn-close-white {
    display: none;
}

.sidebar-nav {
    padding: 0;
}

.sidebar-nav .nav {
    flex-direction: column;
}

.sidebar-nav .nav-item {
    margin: 0;
}

.sidebar-nav .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
    transition: background-color 0.15s ease, color 0.15s ease;
    text-decoration: none;
}

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

.sidebar-nav .nav-link span {
    flex: 1;
}

.sidebar-nav .nav-link:hover {
    /* Mantém destaque sem deslocamento */
    background-color: rgba(255, 255, 255, 0.06);
    color: #fff;
    border-left-color: #4ba3ff;
}

.sidebar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-left-color: #4ba3ff;
    font-weight: 600;
}

.sidebar-overlay {
    position: fixed;
    top: 56px;
    left: 0;
    width: 100%;
    height: calc(100vh - 56px);
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 999;
    transition: opacity 0.3s ease;
}

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

.main-content {
    margin-left: 260px;
    padding: 20px;
    min-height: calc(100vh - 56px);
}

.main-content .container,
.main-content .container-fluid {
    max-width: 100%;
    padding: 20px 20px;
}

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

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

    .sidebar-header .btn-close-white {
        display: block;
        background-color: transparent;
        border: none;
        color: #fff;
        cursor: pointer;
        font-size: 1.5rem;
        padding: 0;
    }

    .sidebar-overlay {
        display: none;
    }

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

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

    #sidebarToggle {
        display: block !important;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
    }

    .main-content .container,
    .main-content .container-fluid {
        padding: 0;
    }

    .navbar {
        padding: 0.5rem 1rem;
    }

    .navbar-brand {
        font-size: 1.2rem;
    }

    body {
        padding-top: 56px;
    }
}

/* ===== SCROLLBAR CUSTOMIZADO ===== */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.modal-header {
    background-color: #263E5A;
    color: #fff;
    border-bottom: none;
}

/* Ajustes específicos para a tabela de clientes */
.table td, .table th {
    vertical-align: middle;
}

.table .btn-sm {
    padding: 0.15rem 0.25rem;
    line-height: 1;
    height: auto;
}

.table td .d-flex {
    gap: 4px; /* fallback spacing */
}

/* Clientes table specific */
.table thead th.col-actions,
.table td.col-actions {
    width: 1px;
    white-space: nowrap;
}

.table td.col-cnpj,
.table th.col-cnpj,
.table td.col-contato,
.table th.col-contato,
.table td.col-status,
.table th.col-status {
    white-space: nowrap;
}

.table td.col-name {
    max-width: 40ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.action-icon {
    display: inline-block;
    width: 26px;
    text-align: center;
    margin: 0 2px;
    font-size: 1rem;
}

.action-icon i {
    vertical-align: middle;
}
