@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--body-bg);
    color: var(--page-text);
}

/* Variáveis de cores */
:root {
    --primary: #3498db;
    --primary-dark: #2980b9;
    --success: #2ecc71;
    --danger: #e74c3c;
    --warning: #f39c12;
    --secondary: #95a5a6;
    --light: #ecf0f1;
    --white: #ffffff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 5px 20px rgba(0, 0, 0, 0.15);
    --header-bg: #000000;
    --header-text: #ffffff;
    --sidebar-bg: #1a232c;
    --sidebar-text: #cfd8dc;
    --sidebar-hover: rgba(255, 255, 255, 0.04);
    --sidebar-active: rgba(74, 163, 255, 0.14);
    --body-bg: #f5f7fa;
    --page-text: #333333;
    --panel-bg: #ffffff;
}

body.theme-light {
    --header-bg: #f4f6f8;
    --header-text: #111111;
    --sidebar-bg: #e7edf4;
    --sidebar-text: #23313f;
    --sidebar-hover: rgba(0, 0, 0, 0.04);
    --sidebar-active: rgba(52, 152, 219, 0.15);
    --body-bg: #ffffff;
    --page-text: #1e293b;
    --panel-bg: #ffffff;
}

/* Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-image: linear-gradient(rgba(0,0,0,0.35), rgba(0,0,0,0.35)), url('https://i.postimg.cc/X71j5B4j/Chat-GPT-Image-21-de-jul-de-2026-18-29-56.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #2980b9;
}

.login-box {
    background: rgba(255,255,255,0.95);
    padding: 28px;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
    width: 100%;
    max-width: 420px; /* caixa menor para login */
    border: 1px solid rgba(0,0,0,0.06);
    backdrop-filter: blur(6px);
}

.login-box h1 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 30px;
    font-size: 28px;
}

.login-box .subtext {
    text-align: center;
    color: #777;
    font-size: 13px;
    margin-top: 6px;
}

.login-logo {
    display: block;
    margin: 0 auto 12px !important;
    width: 120px !important; /* tamanho fixo menor para evitar ocupar muito espaço */
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@media (min-width: 1200px) {
    .login-box {
        max-width: 600px;
        padding: 50px;
    }
    
    .login-logo {
        width: 140px !important; /* ligeiro aumento em telas grandes */
        margin-bottom: 20px !important;
    }
    
    .form-group {
        margin-bottom: 25px;
    }
    
    .btn {
        padding: 14px 24px;
        font-size: 16px;
    }
}

@media (min-width: 1600px) {
    .login-box {
        max-width: 700px;
        padding: 60px;
    }
    
    .login-logo {
        width: 160px !important; /* controlado em telas muito grandes */
        margin-bottom: 24px !important;
    }
}

@media (max-width: 480px) {
    .login-logo {
        width: 100px !important; /* menor em telas muito pequenas */
        margin-bottom: 12px !important;
    }
}

    .form-group {
        margin-bottom: 30px;
    }
    
    .form-group input {
        padding: 14px;
        font-size: 15px;
    }
    
    .btn {
        padding: 16px 28px;
        font-size: 17px;
    }
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e6e9ee;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.12s, box-shadow 0.12s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    color: white;
    width: 100%;
    margin-bottom: 12px;
    box-shadow: 0 6px 18px rgba(52,152,219,0.18);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(52,152,219,0.2);
}

.login-box .btn-primary {
    background: linear-gradient(135deg, #111111 0%, #000000 100%);
    color: white;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.login-box .btn-primary:hover {
    background: #111111;
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.25);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: #27ae60;
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-small {
    padding: 8px 12px;
    font-size: 12px;
    margin: 0 2px;
}

.error {
    color: var(--danger);
    font-size: 14px;
    margin-top: 5px;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid #c3e6cb;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

.info-message {
    background-color: #d1ecf1;
    color: #0c5460;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid #bee5eb;
}

/* Layout Principal */
.header {
    background: linear-gradient(135deg, #0f1720, #1a232c 60%, #111827);
    padding: 12px 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    color: var(--header-text);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

body.theme-light .header {
    background: linear-gradient(135deg, #ffffff, #eef4fa 60%, #e7edf4);
    border-bottom: 1px solid rgba(15, 23, 32, 0.08);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-toggle,
.theme-toggle {
    border: none;
    background: transparent;
    color: inherit;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-toggle:hover,
.theme-toggle:hover {
    background: rgba(255,255,255,0.08);
}

body.theme-light .sidebar-toggle:hover,
body.theme-light .theme-toggle:hover {
    background: rgba(0,0,0,0.05);
}

.sidebar-toggle {
    padding: 0;
}

.sidebar-toggle i,
.theme-toggle i {
    font-size: 18px;
    line-height: 1;
}


.header-brand {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.header-logo {
    height: 48px;
    width: auto;
    border-radius: 8px;
    object-fit: cover;
}

.whatsapp-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

.whatsapp-link:hover {
    text-decoration: underline;
}

.whatsapp-icon {
    width: 24px;
    height: 24px;
    display: inline-block;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-profile {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

.user-profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    display: none;
    z-index: 1000;
    margin-top: 10px;
}

/* Form layout: rows with responsive columns */
.form-row {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.form-row .form-group {
    flex: 1 1 48%;
    min-width: 220px;
}
.form-row.full .form-group {
    flex-basis: 100%;
}

@media (max-width: 900px) {
    .form-row {
        gap: 12px;
    }
    .form-row .form-group {
        flex-basis: 100%;
    }
}

/* Small adjustments for labels and inputs inside cards */
.card h2 { margin-bottom: 12px; font-size: 18px; color: #333; }
.form-group label { font-size: 13px; }
.form-group input, .form-group select, .form-group textarea { font-size: 14px; }

.user-profile-dropdown.active {
    display: block;
}

.user-profile-dropdown a,
.user-profile-dropdown button {
    display: block;
    width: 100%;
    padding: 12px 20px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.user-profile-dropdown a:last-child,
.user-profile-dropdown button:last-child {
    border-bottom: none;
}

.user-profile-dropdown a:hover,
.user-profile-dropdown button:hover {
    background-color: #f5f5f5;
}

/* Sidebar */
.sidebar {
    background: linear-gradient(180deg, #101822, #0e141b 60%, #0c1016);
    width: 220px;
    position: fixed;
    left: 0;
    top: 56px;
    height: calc(100vh - 56px);
    overflow-y: auto;
    box-shadow: 12px 0 30px rgba(0, 0, 0, 0.24);
    transition: width 0.25s ease;
    border-right: 1px solid rgba(255,255,255,0.05);
}

body.theme-light .sidebar {
    background: linear-gradient(180deg, #f8fbff, #e8eef6 60%, #e0e8f2);
    box-shadow: 10px 0 30px rgba(15, 23, 42, 0.08);
    border-right: 1px solid rgba(15, 23, 32, 0.08);
}

.sidebar-collapsed .sidebar {
    width: 76px;
}

.sidebar-collapsed .container {
    margin-left: 96px;
}

.sidebar-collapsed .sidebar-menu a {
    justify-content: center;
    padding: 12px 10px;
    font-size: 0;
}

.sidebar-collapsed .sidebar-menu a i {
    margin-right: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 18px 0;
}

.sidebar-menu li {
    margin: 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.14s ease-in-out;
    border-left: 4px solid transparent;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin: 4px 10px;
    border-radius: 10px;
}

.sidebar-menu a:hover {
    background: linear-gradient(90deg, rgba(74,163,255,0.12), rgba(255,255,255,0.02));
    border-left-color: #4aa3ff;
    color: var(--header-text);
    transform: translateX(1px);
}

.sidebar-menu a.active {
    background: linear-gradient(90deg, rgba(74,163,255,0.18), rgba(255,255,255,0.03));
    color: var(--header-text);
    border-left-color: #4aa3ff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}

.has-submenu {
    position: relative;
}

.submenu-toggle {
    justify-content: space-between;
    align-items: center;
}

.submenu-caret {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.25s ease, opacity 0.2s ease;
    opacity: 0.8;
}

.submenu {
    display: block;
    max-height: 0;
    overflow: hidden;
    list-style: none;
    padding: 0 0 0 16px;
    margin: 0;
    opacity: 0;
    transition: max-height 0.28s ease, opacity 0.22s ease, padding 0.22s ease;
}

.submenu li {
    margin: 2px 0;
}

.submenu a {
    padding: 10px 12px;
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    border-left-color: transparent;
    border-radius: 8px;
    transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.submenu a:hover,
.submenu a.active {
    background: rgba(74, 163, 255, 0.14);
    transform: translateX(2px);
}

.has-submenu.open > .submenu {
    max-height: 140px;
    opacity: 1;
    padding: 6px 0 4px 16px;
}

.has-submenu.open > .submenu-toggle .submenu-caret {
    transform: rotate(180deg);
    opacity: 1;
}

/* Main Content */
.container {
    margin-left: 240px;
    margin-top: 40px;
    padding: 18px 24px 18px 28px;
    transition: margin-left 0.25s ease;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 26px;
    color: #333;
}

.page-header .btn {
    margin: 0;
}

/* Cards */
.card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(31,40,51,0.06);
    margin-bottom: 20px;
    border: 1px solid rgba(0,0,0,0.04);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.report-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
}

.report-filter .filter-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.report-filter label {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    color: #555;
    font-weight: 600;
}

.report-filter input[type="date"] {
    min-width: 170px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #dfe4ea;
    background: #fafbfc;
    font-size: 14px;
}

.report-card {
    border-radius: 16px;
    padding: 28px;
}

.report-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.report-card-header h2 {
    margin: 0;
    font-size: 26px;
    letter-spacing: -0.3px;
}

.report-card-header p {
    margin: 8px 0 0;
    color: #6c7a96;
    font-size: 14px;
}

.report-logo img {
    width: 120px;
    border-radius: 14px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.08);
}

.report-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.metric-item {
    background: #f6f9ff;
    border-radius: 12px;
    padding: 18px 20px;
    border: 1px solid rgba(52, 152, 219, 0.12);
}

.metric-item span {
    display: block;
    color: #556880;
    margin-bottom: 8px;
    font-size: 13px;
}

.metric-item strong {
    display: block;
    font-size: 28px;
    color: #1f3f73;
}

.report-actions {
    margin-top: 24px;
}

@media (max-width: 760px) {
    .report-card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .report-filter {
        width: 100%;
        justify-content: flex-start;
    }

    .report-filter input[type="date"] {
        width: 100%;
    }
}

.card-header h2 {
    margin: 0;
    font-size: 20px;
}

/* Dashboard Stats */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.stat-card {
    padding: 18px 22px;
    border-radius: 12px;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.stat-card h3 {
    font-size: 13px;
    margin-bottom: 10px;
    opacity: 0.95;
}

.stat-card .number {
    font-size: 22px;
    font-weight: 800;
}

.stat-card.success { background: linear-gradient(90deg,#2ecc71,#28b463); }
.stat-card.danger { background: linear-gradient(90deg,#e74c3c,#c0392b); }
.stat-card.warning { background: linear-gradient(90deg,#f39c12,#f1c40f); color: #222; }
.stat-card { background: linear-gradient(90deg,#3498db,#2c82d9); }

/* Charts */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    align-items: start;
}

.chart-card {
    background: white;
    padding: 18px;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(31,40,51,0.06);
    min-height: 360px;
    border: 1px solid rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chart-card h3 {
    margin-bottom: 12px;
    font-size: 16px;
}

.chart-card canvas {
    width: 340px !important;
    height: 340px !important;
    display: block;
    margin: 0 auto;
}

/* Tabelas */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

table thead {
    background-color: #f8f9fa;
}

table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #dee2e6;
}

table td {
    padding: 12px 15px;
    border-bottom: 1px solid #dee2e6;
}

table tbody tr:hover {
    background-color: #f9f9f9;
}

table .actions {
    display: flex;
    gap: 5px;
}

table .btn-small {
    padding: 6px 10px;
    font-size: 12px;
}

/* Formulários */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-row.full {
    grid-template-columns: 1fr;
}

.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    min-height: 100px;
    resize: vertical;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

/* File Upload */
.file-upload-area {
    border: 2px dashed #ddd;
    border-radius: 5px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background-color: #fafafa;
}

.file-upload-area:hover {
    border-color: var(--primary);
    background-color: #f0f8ff;
}

.file-upload-area input[type="file"] {
    display: none;
}

.file-list {
    margin-top: 15px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 5px;
    margin-bottom: 10px;
}

.file-item .file-name {
    flex: 1;
}

.file-item .btn-small {
    margin: 0;
}

/* Status Badge */
.badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.badge-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* Responsivo */
@media (max-width: 768px) {
    /* Sidebar off-canvas on small screens */
    .sidebar {
        position: fixed;
        left: -260px;
        top: 56px;
        width: 220px;
        height: calc(100vh - 56px);
        transition: left 0.25s ease;
        z-index: 1200;
        box-shadow: 12px 0 30px rgba(0, 0, 0, 0.24);
    }

    /* When visible, slide in */
    body.sidebar-visible .sidebar {
        left: 0;
    }

    .container {
        margin-left: 0;
    }

    .stats-container,
    .charts-container,
    .form-row {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    table {
        font-size: 12px;
    }

    table th,
    table td {
        padding: 8px 5px;
    }

    .table-container {
        overflow-x: auto;
    }

    .mobile-menu-toggle {
        display: block;
    }
}

/* Overlay quando a sidebar mobile está aberta */
.sidebar-overlay {
    position: fixed;
    left: 0;
    right: 0;
    top: 56px;
    bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1100;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.modal-close:hover {
    color: #333;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

/* Loading Spinner */
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
