/* FTECH V2.0 - V1 Identity Theme (White Sidebar + Orange) */
/* Imports */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Identidade V1 Padrão */
    --primary-color: #fd7e14;
    /* Orange Padrão Bootstrap/V1 */
    --primary-hover: #e36900;

    --secondary-color: #64748b;
    /* Slate */

    /* Cores de Status */
    --status-success: #198754;
    --status-warning: #ffc107;
    --status-danger: #dc3545;

    /* Layout Colors */
    --sidebar-bg: #ffffff;
    /* WHITE Sidebar */
    --sidebar-color: #495057;
    /* Dark Grey Text */
    --sidebar-width: 260px;
    --sidebar-active-bg: rgba(253, 126, 20, 0.1);
    /* Subtle Orange */
    --sidebar-border: rgba(0, 0, 0, 0.05);

    --body-bg: #f4f6f9;
    /* Light Grey */
    --text-primary: #212529;
    --card-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.05);
    --border-radius: 8px;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--body-bg);
    color: var(--text-primary);
}

/* --- Layout Structure --- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-color);
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.03);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
}

.main-content {
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-height: 100vh;
}

/* --- Sidebar Styling --- */
.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand {
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: -0.5px;
    color: #333;
    /* Dark Title */
    text-decoration: none;
}

.sidebar-brand span {
    color: var(--primary-color);
}

.sidebar-menu {
    padding: 0.8rem;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #dee2e6 transparent;
}

.sidebar-menu .menu-label {
    padding: 1.5rem 1rem 0.5rem 1rem;
    display: block;
}

.sidebar-menu::-webkit-scrollbar {
    width: 5px;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.7rem 1rem;
    color: var(--sidebar-color);
    border-radius: 8px;
    margin-bottom: 2px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none;
    position: relative;
}

.nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(253, 126, 20, 0.04);
    transform: translateX(3px);
}

.nav-link.active {
    background-color: var(--sidebar-active-bg);
    color: var(--primary-color) !important;
    font-weight: 600;
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: -1rem;
    top: 20%;
    height: 60%;
    width: 4px;
    background-color: var(--primary-color);
    border-radius: 0 4px 4px 0;
}

.nav-link i {
    width: 20px;
    text-align: center;
    margin-right: 12px;
    font-size: 1.05rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.nav-link:hover i,
.nav-link.active i {
    opacity: 1;
}

/* Submenu Styles - Premium Transitions */
.nav-group {
    margin-bottom: 2px;
    border-radius: 8px;
    overflow: hidden;
}

.nav-group-header {
    cursor: pointer;
    background: transparent;
}

.nav-group-header .chevron {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.75rem;
    opacity: 0.4;
}

.nav-group.open .nav-group-header {
    background-color: rgba(0, 0, 0, 0.02);
}

.nav-group.open .nav-group-header .chevron {
    transform: rotate(90deg);
}

.sub-menu {
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: rgba(0, 0, 0, 0.02);
    margin: 0 4px;
    border-radius: 0 0 8px 8px;
    opacity: 0;
    visibility: hidden;
}

.nav-group.open .sub-menu {
    max-height: 500px;
    /* Diferença para garantir que caiba tudo */
    opacity: 1;
    visibility: visible;
    padding-bottom: 8px;
    margin-bottom: 4px;
}

.sub-menu .nav-link {
    padding: 0.5rem 1rem 0.5rem 2.8rem;
    font-size: 0.82rem;
    margin-bottom: 0;
    border-radius: 0;
}

.sub-menu .nav-link.active::before {
    left: 1.5rem;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--sidebar-border);
    background-color: #fafafa;
}

.user-snippet {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.5rem;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
}

.user-snippet:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-info span {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Header Navbar --- */
.header-navbar {
    background: transparent;
    padding: 0 0 1.5rem 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

/* --- Buttons --- */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

.btn-primary:hover,
.btn-primary:active,
.btn-primary:focus {
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
    color: white;
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
}

/* --- Cards --- */
.card {
    background: white;
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
}

/* --- Dashboard KPI Cards --- */
.kpi-card {
    position: relative;
    overflow: hidden;
    color: white;
    border: none;
    border-radius: var(--border-radius);
    transition: transform 0.2s;
}

.kpi-card:hover {
    transform: translateY(-5px);
}

.kpi-card.bg-orange {
    background: linear-gradient(135deg, #fd7e14 0%, #e36900 100%);
}

.kpi-card.bg-green {
    background: linear-gradient(135deg, #20c997 0%, #198754 100%);
}

.kpi-card.bg-red {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.kpi-card.bg-yellow {
    background: linear-gradient(135deg, #ffc107 0%, #ffca2c 100%);
    color: #333;
}

/* --- Badge Colors --- */
.bg-purple {
    background-color: #6f42c1 !important;
}

.badge.bg-purple {
    background-color: #6f42c1 !important;
    color: white !important;
}


/* --- Tables --- */
.table-custom tbody tr:hover td {
    background-color: rgba(253, 126, 20, 0.03);
    /* Very subtle orange tint */
}

/* Mobile Adjustments */
@media (max-width: 768px) {

    /* Sidebar Mobile - Escondida por padrão */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
        z-index: 1050;
        /* Maior que o overlay */
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Sidebar Ativa - Visível */
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
    }

    /* Main Content sem margem no mobile */
    .main-content {
        margin-left: 0;
        padding: 1rem;
        width: 100%;
    }

    /* Sidebar Overlay Backdrop */
    .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(3px);
        z-index: 1040;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    /* Overlay visível quando ativo */
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    /* Header Navbar Mobile */
    .header-navbar {
        padding: 0 0 1rem 0;
        position: sticky;
        top: 0;
        background: var(--body-bg);
        z-index: 100;
        margin-bottom: 1rem;
    }

    /* Botão de Toggle visível apenas no mobile */
    #sidebarToggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 8px;
        border: 1px solid #dee2e6;
        background: white;
        color: var(--primary-color);
        transition: all 0.2s;
    }

    #sidebarToggle:hover,
    #sidebarToggle:active {
        background: var(--primary-color);
        color: white;
        border-color: var(--primary-color);
        transform: scale(1.05);
    }

    /* Cards Mobile */
    .card {
        margin-bottom: 1rem;
        border-radius: 12px;
    }

    /* KPI Cards mobile - 2 colunas */
    .row.g-3 .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .kpi-card h3 {
        font-size: 1.3rem;
    }

    /* Buttons full-width no mobile */
    .btn:not(.btn-sm):not(.d-inline-block) {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    /* Table adjustments for mobile */
    .table-responsive {
        border-radius: 12px;
        overflow-x: auto;
        border: 1px solid #eee;
        -webkit-overflow-scrolling: touch;
    }

    .table-custom {
        min-width: 600px;
    }

    .table-custom thead {
        background-color: #fafafa;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .table-custom td,
    .table-custom th {
        white-space: nowrap;
        font-size: 0.85rem;
        padding: 0.75rem 0.5rem;
    }

    /* Formulários mobile */
    .form-control,
    .form-select {
        font-size: 16px;
        /* Evita zoom no iOS */
    }

    /* Badges e Status */
    .badge {
        font-size: 0.7rem;
        padding: 4px 8px;
    }

    /* Modal em mobile */
    .modal-dialog {
        margin: 0.5rem;
    }

    /* User Avatar no header */
    .header-navbar .user-avatar {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    .header-navbar .user-info span {
        font-size: 0.8rem;
    }

    /* Sidebar menu items mobile */
    .nav-link {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }

    .nav-link i {
        font-size: 1.1rem;
        width: 24px;
    }

    /* Sub-menu mobile */
    .sub-menu .nav-link {
        padding: 0.7rem 1rem 0.7rem 3rem;
        font-size: 0.85rem;
    }

    /* Hide desktop-only elements */
    .d-md-block {
        display: none !important;
    }
}

/* Tablets - Ajustes intermediários */
@media (min-width: 769px) and (max-width: 992px) {
    .sidebar {
        width: 240px;
    }

    .main-content {
        margin-left: 240px;
        padding: 1.5rem;
    }

    .row.g-3 .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 576px) {

    /* KPI Cards - 1 coluna em telas muito pequenas */
    .row.g-3 .col-md-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Header compacto */
    .header-navbar {
        padding: 0 0 0.75rem 0;
    }

    .header-navbar .user-info {
        display: none;
        /* Esconde nome no header em telas muito pequenas */
    }

    /* Cards com menos padding */
    .card-body {
        padding: 1rem;
    }

    /* Typography menor */
    h4 {
        font-size: 1.1rem;
    }

    h5 {
        font-size: 1rem;
    }

    /* Status boxes menores */
    .status-box {
        transform: scale(0.9);
    }
}

/* Scrollbar customization for the whole system */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}



/* --- Financeiro / Caixa Page Specifics --- */
:root {
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.5);
    --gradient-open: linear-gradient(135deg, #0cebeb 0%, #20e3b2 50%, #29ffc6 100%);
    --gradient-closed: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-orange: linear-gradient(135deg, #fd7e14 0%, #ff9a44 100%);
}

.status-hero {
    border-radius: 20px;
    padding: 3rem;
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    transition: all 0.4s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-hero.status-aberto {
    background: var(--gradient-open);
}

.status-hero.status-fechado {
    background: var(--gradient-closed);
}

/* Removed decorative circle (visual artifact) */

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
}

.stat-box {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.stat-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

.currency-input {
    font-size: 2.2rem !important;
    font-weight: 800 !important;
    text-align: center;
    border-radius: 16px !important;
    border: 2px solid #e2e8f0 !important;
    color: var(--primary-color) !important;
    background-color: #f8fafc;
    padding: 1rem !important;
    transition: all 0.3s ease;
}

.currency-input:focus {
    border-color: var(--primary-color) !important;
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(253, 126, 20, 0.15) !important;
    outline: none;
}

.btn-action {
    border-radius: 12px;
    padding: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.history-item {
    border-left: 4px solid var(--primary-color);
    padding: 1.2rem;
    margin-bottom: 12px;
    background: white;
    border-radius: 0 12px 12px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    border: 1px solid rgba(0, 0, 0, 0.03);
    border-left: 4px solid var(--primary-color);
    /* Reinforce */
}

.history-item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.badge-pill {
    border-radius: 50px;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}