/**
 * Sistema de Cadastro de Empresas - Xambioá-TO
 * Estilos Personalizados
 */

/* =========================================
   VARIÁVEIS CSS
   ========================================= */
:root {
    --primary-color: #1e3a5f;
    --primary-light: #2c5282;
    --primary-dark: #1a2f4a;
    --secondary-color: #2d9cdb;
    --accent-color: #27ae60;
    --accent-light: #2ecc71;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --dark-color: #2c3e50;
    --light-color: #f8f9fa;
    --gray-100: #f7fafc;
    --gray-200: #edf2f7;
    --gray-300: #e2e8f0;
    --gray-400: #cbd5e0;
    --gray-500: #a0aec0;
    --gray-600: #718096;
    --gray-700: #4a5568;
    --gray-800: #2d3748;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 70px;
    --footer-height: 80px;
    --border-radius: 12px;
    --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --box-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s ease;
}

/* =========================================
   RESET & BASE
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
    min-height: 100vh;
    color: var(--gray-800);
    overflow-x: hidden;
}

/* =========================================
   LAYOUT WRAPPER
   ========================================= */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding-bottom: 120px;
    transition: var(--transition);
}

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

/* =========================================
   SIDEBAR
   ========================================= */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
    box-shadow: var(--box-shadow-lg);
}

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

/* Overlay para mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    animation: fadeIn 0.2s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.2;
}

.logo-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    font-weight: 400;
}

.sidebar.collapsed .logo-text {
    display: none;
}

/* Sidebar Navigation */
.sidebar-nav {
    list-style: none;
    padding: 15px 0;
    margin: 0;
}

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

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.9rem;
}

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

.nav-link.active {
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    color: #fff;
    box-shadow: 0 4px 15px rgba(45, 156, 219, 0.3);
}

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

.sidebar.collapsed .nav-link span {
    display: none;
}

.nav-divider {
    padding: 15px 20px 8px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

.sidebar.collapsed .nav-divider span {
    display: none;
}

/* =========================================
   TOP NAVBAR
   ========================================= */
.navbar {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    padding: 15px 20px;
}

#sidebarToggle {
    font-size: 1.2rem;
    padding: 8px 12px;
    border-radius: 8px;
    transition: var(--transition);
}

#sidebarToggle:hover {
    background: var(--gray-200);
}

.user-avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-info span {
    font-size: 0.9rem;
}

.user-info small {
    font-size: 0.75rem;
}

/* =========================================
   CARDS
   ========================================= */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    background: #fff;
    overflow: hidden;
}

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

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--gray-200);
    padding: 20px 25px;
    font-weight: 600;
}

.card-body {
    padding: 25px;
}

/* Stats Cards */
.stats-card {
    position: relative;
    overflow: hidden;
    border: none;
}

.stats-card .card-body {
    position: relative;
    z-index: 1;
}

.stats-card .stats-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 4rem;
    opacity: 0.15;
    color: var(--primary-color);
}

.stats-card.bg-primary .stats-icon,
.stats-card.bg-success .stats-icon,
.stats-card.bg-warning .stats-icon,
.stats-card.bg-info .stats-icon {
    color: #fff;
    opacity: 0.2;
}

.stats-card .stats-number {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 5px;
}

.stats-card .stats-label {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 500;
}

.stats-card.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light)) !important;
}

.stats-card.bg-gradient-success {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-light)) !important;
}

.stats-card.bg-gradient-info {
    background: linear-gradient(135deg, var(--secondary-color), #5dade2) !important;
}

.stats-card.bg-gradient-warning {
    background: linear-gradient(135deg, var(--warning-color), #f5b041) !important;
}

/* =========================================
   BUTTONS
   ========================================= */
.btn {
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 500;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    box-shadow: 0 4px 15px rgba(30, 58, 95, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 58, 95, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, var(--accent-light), var(--accent-color));
    transform: translateY(-2px);
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* =========================================
   FORMS
   ========================================= */
.form-control,
.form-select {
    border-radius: 8px;
    border: 2px solid var(--gray-300);
    padding: 12px 15px;
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(45, 156, 219, 0.15);
}

.form-label {
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.input-group-text {
    border-radius: 8px;
    border: 2px solid var(--gray-300);
    background: var(--gray-100);
}

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

.table thead th {
    background: var(--gray-100);
    border-bottom: 2px solid var(--gray-300);
    color: var(--gray-700);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 15px;
}

.table tbody td {
    padding: 15px;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-200);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table-responsive {
    border-radius: var(--border-radius);
    overflow: hidden;
}

/* =========================================
   BADGES
   ========================================= */
.badge {
    padding: 6px 12px;
    border-radius: 50px;
    font-weight: 500;
    font-size: 0.75rem;
}

.badge-success {
    background: rgba(39, 174, 96, 0.15);
    color: var(--accent-color);
}

.badge-warning {
    background: rgba(243, 156, 18, 0.15);
    color: var(--warning-color);
}

.badge-danger {
    background: rgba(231, 76, 60, 0.15);
    color: var(--danger-color);
}

/* =========================================
   FOOTER
   ========================================= */
.footer {
    position: fixed;
    bottom: 0;
    right: 0;
    left: var(--sidebar-width);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: rgba(255, 255, 255, 0.9);
    padding: 15px 0;
    z-index: 100;
    transition: var(--transition);
}

.footer p {
    font-size: 0.85rem;
}

.footer-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.footer-link:hover {
    color: var(--accent-light);
    text-decoration: underline;
}

/* =========================================
   PAGE HEADER
   ========================================= */
.page-header {
    margin-bottom: 30px;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 5px;
}

.page-subtitle {
    color: var(--gray-600);
    font-size: 0.95rem;
}

.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 10px;
}

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

.breadcrumb-item.active {
    color: var(--gray-600);
}

/* =========================================
   ALERTS
   ========================================= */
.alert {
    border: none;
    border-radius: var(--border-radius);
    padding: 15px 20px;
    border-left: 4px solid;
}

.alert-success {
    background: rgba(39, 174, 96, 0.1);
    border-left-color: var(--accent-color);
    color: var(--accent-color);
}

.alert-danger {
    background: rgba(231, 76, 60, 0.1);
    border-left-color: var(--danger-color);
    color: var(--danger-color);
}

.alert-warning {
    background: rgba(243, 156, 18, 0.1);
    border-left-color: var(--warning-color);
    color: var(--warning-color);
}

/* =========================================
   LOGIN PAGE
   ========================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 50%, var(--secondary-color) 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    animation: backgroundMove 20s linear infinite;
}

@keyframes backgroundMove {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(-50%, -50%);
    }
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 50px 40px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo i {
    font-size: 4rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-logo h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-top: 15px;
    font-weight: 700;
}

.login-logo p {
    color: var(--gray-600);
    font-size: 0.9rem;
}

.login-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

.login-footer a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
}

/* =========================================
   LOADING SPINNER
   ========================================= */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* =========================================
   CHARTS
   ========================================= */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* =========================================
   RESPONSIVE - MOBILE FIRST
   ========================================= */

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

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

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

    .footer {
        position: relative;
        left: 0;
        margin-top: 30px;
    }

    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* Mobile */
@media (max-width: 767.98px) {
    :root {
        --border-radius: 10px;
    }

    body {
        font-size: 14px;
    }

    /* Main Content sem padding excessivo */
    .main-content {
        padding-bottom: 10px;
    }

    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Navbar mais compacta */
    .navbar {
        padding: 10px 15px;
        border-radius: 0;
    }

    #sidebarToggle {
        padding: 6px 10px;
    }

    .user-info {
        display: none !important;
    }

    /* Cards mais compactos */
    .card {
        border-radius: 10px;
        margin-bottom: 15px;
    }

    .card-header {
        padding: 15px;
    }

    .card-body {
        padding: 15px;
    }

    /* Stats Cards menores */
    .stats-card .stats-number {
        font-size: 1.5rem;
    }

    .stats-card .stats-label {
        font-size: 0.75rem;
    }

    .stats-card .stats-icon {
        font-size: 2.5rem;
        right: 10px;
    }

    /* Page Header compacto */
    .page-header {
        margin-bottom: 15px;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .page-subtitle {
        font-size: 0.85rem;
    }

    .breadcrumb {
        font-size: 0.8rem;
        margin-bottom: 5px;
    }

    /* Formulários otimizados para toque */
    .form-control,
    .form-select {
        padding: 14px 12px;
        font-size: 16px;
        /* Evita zoom no iOS */
        border-radius: 8px;
    }

    .form-label {
        font-size: 0.85rem;
        margin-bottom: 5px;
    }

    .input-group .btn {
        padding: 14px 15px;
    }

    /* Botões maiores para toque */
    .btn {
        padding: 12px 20px;
        font-size: 0.95rem;
    }

    .btn-sm {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .btn-group .btn {
        padding: 10px 14px;
    }

    /* Tabelas responsivas */
    .table thead th {
        padding: 10px 8px;
        font-size: 0.7rem;
    }

    .table tbody td {
        padding: 10px 8px;
        font-size: 0.85rem;
    }

    .table .btn-group {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    .table .btn-group .btn {
        width: 100%;
    }

    /* Footer não fixo no mobile */
    .footer {
        position: relative;
        left: 0;
        margin-top: 20px;
        padding: 20px 15px;
    }

    .footer p {
        font-size: 0.75rem;
    }

    /* Login Page */
    .login-card {
        padding: 25px 20px;
        margin: 15px;
        max-width: 100%;
    }

    .login-logo i {
        font-size: 3rem;
    }

    .login-logo h1 {
        font-size: 1.25rem;
    }

    /* Modals */
    .modal-dialog {
        margin: 10px;
    }

    .modal-content {
        border-radius: 15px;
    }

    /* Gráficos menores */
    .chart-container {
        height: 200px;
    }

    /* Row com menos gap */
    .row.g-4 {
        --bs-gutter-y: 0.75rem;
        --bs-gutter-x: 0.75rem;
    }

    .row.g-3 {
        --bs-gutter-y: 0.5rem;
        --bs-gutter-x: 0.5rem;
    }

    /* Filtros empilhados */
    .page-header.d-flex {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    .page-header .d-flex.gap-2 {
        width: 100%;
    }

    .page-header .d-flex.gap-2 .btn {
        flex: 1;
    }

    /* Alertas compactos */
    .alert {
        padding: 12px 15px;
        font-size: 0.85rem;
    }

    /* Badge menor */
    .badge {
        padding: 4px 8px;
        font-size: 0.7rem;
    }

    /* HR menor */
    hr {
        margin-top: 10px !important;
        margin-bottom: 10px !important;
    }

    /* Margin bottom ajustado */
    .mb-4 {
        margin-bottom: 1rem !important;
    }

    .mb-5 {
        margin-bottom: 1.5rem !important;
    }
}

/* Telas muito pequenas */
@media (max-width: 400px) {

    .form-control,
    .form-select {
        padding: 12px 10px;
    }

    .btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }

    .page-title {
        font-size: 1.1rem;
    }

    .stats-card .stats-number {
        font-size: 1.25rem;
    }

    .table tbody td {
        font-size: 0.8rem;
        padding: 8px 5px;
    }

    .table thead th {
        font-size: 0.65rem;
        padding: 8px 5px;
    }
}

/* =========================================
   ANIMATIONS
   ========================================= */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* =========================================
   UTILITIES
   ========================================= */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-light-primary {
    background: rgba(30, 58, 95, 0.1);
}

.bg-light-success {
    background: rgba(39, 174, 96, 0.1);
}

.rounded-xl {
    border-radius: var(--border-radius);
}

/* Safe area para dispositivos com notch */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .footer {
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
    }
}