/* ===================================
   Zapform Faturamento - DrCapivara Theme
   Baseado na identidade visual do DrCapivara
   =================================== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
    /* Paleta DrCapivara */
    --brand-primary: #1f3b63;
    --brand-secondary: #305b95;
    --brand-accent: #f29f5c;
    --brand-background: #eef6fb;
    --brand-surface: #ffffff;
    --brand-text: #1d2a35;
    --brand-muted: rgba(29, 42, 53, 0.6);

    /* Sidebar */
    --sidebar-gradient-start: #11243d;
    --sidebar-gradient-end: #1f3b63;
    --sidebar-text: #ffffff;

    /* UI Elements */
    --surface-elevated: #ffffff;
    --surface-border: rgba(31, 59, 99, 0.2);
    --button-surface: #e6ebf4;
    --button-border: rgba(31, 59, 99, 0.25);
    --button-text: #1f3b63;

    /* Status Colors */
    --color-success: #2e8f55;
    --color-danger: #c04b4b;
    --color-warning: #ca8a04;
    --color-info: #0284c7;

    /* Sombras DrCapivara */
    --shadow-sm: 0 10px 24px rgba(17, 36, 61, 0.08);
    --shadow-md: 0 18px 36px rgba(5, 17, 28, 0.22);
    --shadow-lg: 0 28px 60px rgba(17, 36, 61, 0.14);
    --shadow-xl: 0 36px 72px rgba(17, 36, 61, 0.18);

    /* Border Radius */
    --radius-sm: 12px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
}

* {
    font-family: 'Segoe UI', 'Poppins', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: var(--brand-background);
    color: var(--brand-text);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ===================================
   Typography
   =================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    font-weight: 700;
    color: var(--brand-primary);
    letter-spacing: -0.01em;
}

.text-muted {
    color: var(--brand-muted) !important;
}

/* ===================================
   Cards
   =================================== */
.card {
    background: var(--brand-surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    color: var(--brand-text);
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.card:hover {
    border-color: rgba(48, 91, 149, 0.25);
    box-shadow: var(--shadow-xl);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--surface-border);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--brand-primary);
}

.card-body {
    padding: 1.5rem;
    background: transparent;
    color: var(--brand-text);
}

.card-accent {
    border-left: 3px solid var(--brand-accent);
}

/* ===================================
   Botões
   =================================== */
.btn {
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    border: none;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(48, 91, 149, 0.28);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: var(--brand-secondary);
    border-color: var(--brand-secondary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--brand-accent);
    border-color: var(--brand-accent);
    color: #ffffff;
}

.btn-primary:focus,
.btn-primary:active {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #ffffff;
}

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

.btn-success:hover {
    background-color: #25774a;
    color: white;
}

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

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

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

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

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

.btn-outline-secondary {
    color: var(--brand-secondary);
    border: 1px solid var(--surface-border);
    background: rgba(255, 255, 255, 0.02);
}

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

.btn-sm {
    padding: 0.45rem 1.1rem;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* ===================================
   Forms
   =================================== */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1px solid var(--surface-border);
    padding: 0.65rem 0.8rem;
    background: var(--surface-elevated);
    color: var(--brand-text);
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(31, 59, 99, 0.1);
    outline: none;
}

.form-control::placeholder {
    color: var(--brand-muted);
    opacity: 0.72;
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--brand-primary);
    margin-bottom: 0.5rem;
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    border: 1.5px solid var(--surface-border);
    border-radius: 0.3rem;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--brand-secondary);
    border-color: var(--brand-secondary);
}

.form-check-input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(31, 59, 99, 0.1);
}

/* ===================================
   Badges
   =================================== */
.badge {
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-sm);
}

.bg-primary {
    background: var(--brand-primary) !important;
}

.bg-success {
    background: var(--color-success) !important;
}

.bg-warning {
    background: var(--color-warning) !important;
}

.bg-info {
    background: var(--color-info) !important;
}

.bg-danger {
    background: var(--color-danger) !important;
}

/* ===================================
   List Groups
   =================================== */
.list-group-item {
    background: var(--brand-surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    padding: 0.875rem 1rem;
    transition: all 0.2s ease;
}

.list-group-item:hover {
    border-color: rgba(48, 91, 149, 0.35);
    background: rgba(48, 91, 149, 0.03);
    transform: translateX(2px);
}

/* ===================================
   Tables
   =================================== */
.table {
    font-size: 0.9rem;
    color: var(--brand-text);
}

.table thead {
    background: rgba(31, 59, 99, 0.04);
    color: var(--brand-text);
    border-bottom: 2px solid var(--surface-border);
}

.table thead th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--brand-primary);
    border: none;
    padding: 0.85rem 1rem;
}

.table tbody tr {
    color: var(--brand-text);
    background: rgba(255, 255, 255, 0.01);
    border-bottom: 1px solid var(--surface-border);
}

.table tbody tr:hover {
    background: rgba(48, 91, 149, 0.04);
    color: var(--brand-text);
}

.table tbody td {
    padding: 0.875rem 1rem;
    border: none;
}

/* ===================================
   Progress Bar
   =================================== */
.progress {
    height: 0.75rem;
    border-radius: 999px;
    background: rgba(31, 59, 99, 0.08);
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--brand-secondary) 0%, var(--brand-primary) 100%);
    transition: width 0.3s ease;
    box-shadow: 0 2px 8px rgba(31, 59, 99, 0.2);
}

/* ===================================
   Scrollbar
   =================================== */
.client-list::-webkit-scrollbar,
#reportClientsList::-webkit-scrollbar,
#allClientsList::-webkit-scrollbar {
    width: 8px;
}

.client-list::-webkit-scrollbar-track,
#reportClientsList::-webkit-scrollbar-track,
#allClientsList::-webkit-scrollbar-track {
    background: transparent;
}

.client-list::-webkit-scrollbar-thumb,
#reportClientsList::-webkit-scrollbar-thumb,
#allClientsList::-webkit-scrollbar-thumb {
    background: rgba(31, 59, 99, 0.3);
    border-radius: 4px;
}

.client-list::-webkit-scrollbar-thumb:hover,
#reportClientsList::-webkit-scrollbar-thumb:hover,
#allClientsList::-webkit-scrollbar-thumb:hover {
    background: rgba(31, 59, 99, 0.5);
}

/* ===================================
   Config Container
   =================================== */
.config-container {
    background: rgba(31, 59, 99, 0.02);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-top: 0.75rem;
    box-shadow: inset 0 2px 4px rgba(31, 59, 99, 0.05);
}

/* ===================================
   Period Section
   =================================== */
.period-section {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(238, 246, 251, 0.9) 100%);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.period-shortcuts {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ===================================
   Alerts
   =================================== */
.alert {
    border-radius: var(--radius-md);
    border: 1px solid;
    font-size: 0.9rem;
    padding: 0.875rem 1rem;
}

.alert-info {
    background-color: rgba(96, 165, 250, 0.12);
    border-color: rgba(96, 165, 250, 0.28);
    color: var(--brand-primary);
}

.alert-success {
    background-color: rgba(22, 163, 74, 0.16);
    border-color: rgba(22, 163, 74, 0.34);
    color: #166534;
}

.alert-warning {
    background-color: rgba(250, 204, 21, 0.16);
    border-color: rgba(250, 204, 21, 0.30);
    color: #854d0e;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.34);
    color: #991b1b;
}

/* ===================================
   Animações
   =================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeIn 0.3s ease-out;
}

/* ===================================
   Spinner
   =================================== */
.spinner-border {
    border-color: rgba(31, 59, 99, 0.15);
    border-right-color: var(--brand-primary);
}

/* ===================================
   Utilities
   =================================== */
.text-gradient {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 50%, var(--brand-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.divider {
    height: 1px;
    background: var(--surface-border);
    margin: 1.5rem 0;
}

/* ===================================
   Modal
   =================================== */
.modal-content {
    border-radius: var(--radius-lg);
    border: none;
    box-shadow: 0 20px 40px rgba(31, 59, 99, 0.25);
}

/* ===================================
   Sidebar Navigation
   =================================== */
body.layout {
    display: flex;
    min-height: 100vh;
    background: var(--brand-background);
}

#sidebar {
    flex: 0 0 64px;
    width: 64px;
    min-height: 100vh;
    background: linear-gradient(180deg, var(--sidebar-gradient-start) 0%, var(--sidebar-gradient-end) 100%);
    color: var(--sidebar-text);
    box-shadow: 0 10px 30px rgba(17, 36, 61, 0.35);
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.9rem 0.3rem;
    gap: 1.6rem;
    transition: flex-basis 0.25s ease, width 0.25s ease, padding 0.25s ease, align-items 0.25s ease;
    overflow: hidden;
}

#sidebar:hover,
#sidebar:focus-within {
    flex-basis: 260px;
    width: 260px;
    align-items: flex-start;
    padding: 1.5rem 1rem;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-bottom: none;
    min-height: auto;
    width: 100%;
    transition: all 0.25s ease;
}

#sidebar:hover .sidebar-header,
#sidebar:focus-within .sidebar-header {
    justify-content: flex-start;
}

.sidebar-logo {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--brand-accent) 0%, #ff9d4d 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.75rem;
    font-family: 'Poppins', sans-serif;
    color: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(242, 159, 92, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.05em;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-logo:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(242, 159, 92, 0.5);
}

.sidebar-text {
    margin-left: 1rem;
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    white-space: nowrap;
}

#sidebar:hover .sidebar-text,
#sidebar:focus-within .sidebar-text {
    opacity: 1;
    transform: translateX(0);
}

.sidebar-header h4 {
    font-weight: 700;
    font-size: 1.25rem;
    margin: 0;
    color: #ffffff;
    letter-spacing: 0.02em;
}

.sidebar-header p {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0.25rem 0 0 0;
}

#sidebar .nav {
    width: 100%;
    flex: 1;
}

#sidebar .nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0.55rem 0;
    color: rgba(255, 255, 255, 0.75);
    border-left: 2px solid transparent;
    border-radius: 14px;
    transition: all 0.2s ease;
    font-weight: 500;
    white-space: nowrap;
    min-height: 44px;
    position: relative;
    text-decoration: none;
}

#sidebar:hover .nav-link,
#sidebar:focus-within .nav-link {
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.65rem 0.5rem;
}

#sidebar .nav-link i {
    width: 32px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0;
    font-size: 1.2rem;
    flex-shrink: 0;
    transition: margin 0.2s ease;
    line-height: 1;
}

#sidebar:hover .nav-link i,
#sidebar:focus-within .nav-link i {
    margin-right: 0;
}

#sidebar .nav-link span {
    opacity: 0;
    display: none;
    transform: translateX(-6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    white-space: nowrap;
}

#sidebar:hover .nav-link span,
#sidebar:focus-within .nav-link span {
    display: inline;
    opacity: 1;
    transform: translateX(0);
}

#sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

#sidebar .nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    border-left-color: var(--brand-accent);
    color: #ffffff;
    font-weight: 600;
}

.divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 1rem 0.75rem;
    transition: margin 0.25s ease;
}

#sidebar:hover .divider,
#sidebar:focus-within .divider {
    margin: 1rem 0;
}

#sidebar .px-2 {
    width: 100%;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    transition: padding 0.25s ease;
}

#sidebar:hover .px-2,
#sidebar:focus-within .px-2 {
    padding-left: 0rem !important;
    padding-right: 0rem !important;
}

.main-content {
    flex: 1;
    padding: 2rem;
    background: var(--brand-background);
    min-height: 100vh;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(17, 36, 61, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 999;
}

/* ===================================
   Responsividade
   =================================== */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .period-shortcuts {
        flex-direction: column;
    }

    .period-shortcuts .btn {
        width: 100%;
    }

    .form-control, .form-select {
        font-size: 16px;
        padding: 0.75rem 0.85rem;
    }

    #sidebar {
        position: fixed;
        left: -260px;
        width: 260px !important;
        flex-basis: 260px !important;
        z-index: 1000;
        transition: left 0.3s ease;
        align-items: flex-start !important;
        padding: 1.5rem 1rem !important;
    }

    #sidebar.show {
        left: 0;
    }

    #sidebar .sidebar-text,
    #sidebar .nav-link span {
        opacity: 1 !important;
        display: inline !important;
        transform: translateX(0) !important;
    }

    #sidebar .sidebar-header {
        justify-content: flex-start !important;
    }

    #sidebar .nav-link {
        justify-content: flex-start !important;
        padding: 0.65rem 0.5rem !important;
        gap: 0.75rem !important;
    }

    #sidebar .nav-link i {
        margin-right: 0 !important;
    }

    #sidebar .px-2 {
        padding-left: 0rem !important;
        padding-right: 0rem !important;
    }

    .main-content {
        padding: 1rem;
        width: 100%;
    }

    .sidebar-overlay.show {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }
}
