/* ==========================================================
   Folha+ Custom Stylesheet
   Bootstrap 5.3 based modern clean design
   ========================================================== */

:root {
    --fp-primary: #4f46e5;
    --fp-primary-hover: #4338ca;
    --fp-primary-light: #eef2ff;
    --fp-sidebar-bg: #1e293b;
    --fp-sidebar-hover: #334155;
    --fp-sidebar-active: #4f46e5;
    --fp-sidebar-text: #94a3b8;
    --fp-sidebar-text-active: #ffffff;
    --fp-sidebar-width: 260px;
    --fp-header-height: 64px;
    --fp-body-bg: #f1f5f9;
    --fp-card-bg: #ffffff;
    --fp-text-primary: #1e293b;
    --fp-text-secondary: #64748b;
    --fp-border-color: #e2e8f0;
    --fp-success: #10b981;
    --fp-danger: #ef4444;
    --fp-warning: #f59e0b;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--fp-body-bg);
    color: var(--fp-text-primary);
    overflow-x: hidden;
}

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

.main-content {
    flex: 1;
    margin-left: var(--fp-sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    transition: margin-left 0.3s ease;
}

.content-area {
    flex: 1;
    padding: 1.5rem;
}

/* ========== Sidebar ========== */
.sidebar {
    width: var(--fp-sidebar-width);
    background: var(--fp-sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1040;
    overflow-y: auto;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    height: var(--fp-header-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-brand a {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.sidebar-logo {
    height: 38px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-brand-text {
    color: #fff;
    font-weight: 700;
    font-size: 1.35rem;
    margin: 0;
    white-space: nowrap;
    transition: opacity 0.2s ease;
}

.sidebar-brand-text span {
    color: #818cf8;
}

.sidebar-brand h4 {
    color: #fff;
    font-weight: 700;
    font-size: 1.35rem;
    margin: 0;
}

.sidebar-brand h4 span {
    color: #818cf8;
}

.sidebar-nav {
    padding: 0.75rem 0;
    list-style: none;
    flex: 1;
    margin: 0;
}

.sidebar-nav .nav-label {
    padding: 0.75rem 1.25rem 0.35rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fp-sidebar-text);
    margin-top: 0.5rem;
}

.sidebar-nav .nav-item {
    margin: 2px 8px;
    list-style: none;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.55rem 1rem;
    color: var(--fp-sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    gap: 0.75rem;
}

.sidebar-nav .nav-link:hover {
    background: var(--fp-sidebar-hover);
    color: var(--fp-sidebar-text-active);
}

.sidebar-nav .nav-link.active {
    background: var(--fp-sidebar-active);
    color: var(--fp-sidebar-text-active);
}

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

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

/* ========== Header ========== */
.top-header {
    height: var(--fp-header-height);
    background: var(--fp-card-bg);
    border-bottom: 1px solid var(--fp-border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.filial-selector .form-select {
    min-width: 200px;
    font-size: 0.85rem;
    border-radius: 8px;
    border-color: var(--fp-border-color);
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--fp-border-color);
    border-radius: 50px;
    background: transparent;
    cursor: pointer;
    text-decoration: none;
    color: var(--fp-text-primary);
    transition: all 0.2s;
}

.user-profile-btn:hover {
    background: var(--fp-body-bg);
    color: var(--fp-text-primary);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--fp-primary-light);
    color: var(--fp-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-info {
    text-align: left;
    line-height: 1.3;
}

.user-info .user-name {
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0;
}

.user-info .user-role {
    font-size: 0.7rem;
    color: var(--fp-text-secondary);
    margin: 0;
}

/* ========== Cards ========== */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    background: var(--fp-card-bg);
    overflow: hidden;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--fp-border-color);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

/* ========== Tables ========== */
.table {
    font-size: 0.85rem;
    margin-bottom: 0;
}

.table thead th {
    background: #f8fafc;
    color: var(--fp-text-secondary);
    border: none;
    border-bottom: 2px solid var(--fp-border-color);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.7rem 1rem;
    white-space: nowrap;
}

.thead-blue th {
    background: #f8fafc !important;
    color: var(--fp-text-secondary) !important;
    border-bottom: 2px solid var(--fp-border-color) !important;
}

.table td {
    padding: 0.65rem 1rem;
    vertical-align: middle;
    border-color: var(--fp-border-color);
}

.table-hover tbody tr:hover {
    background-color: #f8fafc;
}

/* ========== Buttons ========== */
.btn {
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.45rem 1rem;
    transition: all 0.2s;
}

.btn-sm {
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
}

.btn-primary {
    background: var(--fp-primary);
    border-color: var(--fp-primary);
}

.btn-primary:hover {
    background: var(--fp-primary-hover);
    border-color: var(--fp-primary-hover);
}

.btn-primaryz {
    background: var(--fp-primary);
    border-color: var(--fp-primary);
    color: #fff;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.45rem 1rem;
}

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

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

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

.btn-warning {
    background: var(--fp-warning);
    border-color: var(--fp-warning);
    color: #1e293b;
}

.btn-outline-primary {
    color: var(--fp-primary);
    border-color: var(--fp-primary);
}

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

.btn-outline-light {
    color: var(--fp-sidebar-text);
    border-color: rgba(255,255,255,0.15);
}

.btn-outline-light:hover {
    background: var(--fp-sidebar-hover);
    color: #fff;
    border-color: rgba(255,255,255,0.25);
}

/* ========== Forms ========== */
.form-control,
.form-select {
    border-radius: 8px;
    border-color: var(--fp-border-color);
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    background-color: #fff;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--fp-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background-color: #fff;
}

.form-label {
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--fp-text-secondary);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-control-sm,
.form-select-sm {
    font-size: 0.8rem;
    padding: 0.35rem 0.65rem;
}

/* Form section — groups of fields with a title/divider */
.form-section {
    background: #f8fafc;
    border: 1px solid var(--fp-border-color);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.form-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--fp-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section-title i {
    font-size: 0.9rem;
    color: var(--fp-primary);
}

/* Form actions row (submit buttons) */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--fp-border-color);
}

/* Inline filter bar above tables */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
    padding: 0.85rem 1rem;
    background: #f8fafc;
    border: 1px solid var(--fp-border-color);
    border-radius: 10px;
    margin-bottom: 1rem;
}

.filter-bar .filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 180px;
}

.filter-bar .filter-group label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--fp-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.filter-bar .filter-group .form-select,
.filter-bar .filter-group .form-control {
    font-size: 0.82rem;
}

/* Separator within forms */
.form-divider {
    border: none;
    border-top: 1px solid var(--fp-border-color);
    margin: 1.25rem 0;
}

/* ========== Alerts ========== */
.alert {
    border-radius: 10px;
    border: none;
    font-size: 0.875rem;
}

/* ========== Page Header ========== */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--fp-text-primary);
    margin: 0;
}

.page-header p {
    color: var(--fp-text-secondary);
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
}

/* ========== Dashboard Cards ========== */
.dashboard-card {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.dashboard-card .card-img-top {
    height: 140px;
    object-fit: cover;
}

.dashboard-card .card-body {
    padding: 1rem;
}

.dashboard-card .card-body h5 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    color: var(--fp-text-primary);
}

.dashboard-card:hover .card-body h5 {
    color: var(--fp-primary);
}

/* ========== Competencias Panel ========== */
.competencias-panel .list-group-item {
    border: none;
    border-bottom: 1px solid var(--fp-border-color);
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.competencias-panel .list-group-item:hover {
    background: var(--fp-primary-light);
}

.competencias-panel .list-group-item:last-child {
    border-bottom: none;
}

/* ========== Footer ========== */
.app-footer {
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--fp-text-secondary);
    border-top: 1px solid var(--fp-border-color);
    background: var(--fp-card-bg);
}

/* ========== Login Page ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 440px;
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.15);
    padding: 2.5rem;
    background: #fff;
}

.login-card .brand-title {
    text-align: center;
    margin-bottom: 2rem;
}

.login-card .brand-title img {
    max-height: 100px;
    margin-bottom: 1rem;
}

.login-card .brand-title h2 {
    font-weight: 700;
    color: var(--fp-primary);
    margin-bottom: 0.25rem;
}

.login-card .brand-title p {
    color: var(--fp-text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.login-card .form-group {
    margin-bottom: 1.25rem;
}

.login-card .form-group label {
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    display: block;
}

.login-card .btn-login {
    width: 100%;
    padding: 0.65rem;
    font-weight: 600;
    font-size: 0.95rem;
    background: var(--fp-primary);
    border-color: var(--fp-primary);
    border-radius: 8px;
}

.login-card .btn-login:hover {
    background: var(--fp-primary-hover);
    border-color: var(--fp-primary-hover);
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
}

.login-footer a {
    color: var(--fp-primary);
    font-size: 0.85rem;
    text-decoration: none;
}

.login-footer a:hover {
    text-decoration: underline;
}

.login-info {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--fp-border-color);
}

.login-info h6 {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.login-info p {
    font-size: 0.8rem;
    color: var(--fp-text-secondary);
    margin: 0;
}

/* ========== Sidebar collapsed (desktop) ========== */
@media (min-width: 992px) {
    .sidebar.collapsed {
        width: 70px;
    }

    .sidebar.collapsed .sidebar-brand {
        justify-content: center;
        padding: 0 0.5rem;
    }

    .sidebar.collapsed .sidebar-logo {
        height: 28px;
    }

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

    .sidebar.collapsed .sidebar-brand h4 {
        font-size: 1.1rem;
    }

    .sidebar.collapsed .sidebar-brand h4 span {
        display: none;
    }

    .sidebar.collapsed .sidebar-nav .nav-label {
        display: none;
    }

    .sidebar.collapsed .sidebar-nav .nav-link {
        text-align: center;
        padding: 0.7rem 0.5rem;
        font-size: 0;
    }

    .sidebar.collapsed .sidebar-nav .nav-link i {
        margin-right: 0;
        font-size: 1.15rem;
    }

    .sidebar.collapsed .sidebar-footer {
        padding: 0.75rem 0.5rem;
    }

    .sidebar.collapsed .sidebar-footer .btn {
        font-size: 0;
        padding: 0.4rem;
    }

    .sidebar.collapsed .sidebar-footer .btn i {
        font-size: 1rem;
        margin: 0;
    }

    .main-content.sidebar-collapsed {
        margin-left: 70px;
    }
}

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

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

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

    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1035;
        display: none;
    }

    .sidebar-backdrop.show {
        display: block;
    }

    .content-area {
        padding: 1rem;
    }

    /* Header adjustments */
    .top-header {
        padding: 0 1rem;
    }

    /* Card header buttons stack */
    .card-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .card-header .btn {
        width: 100%;
        justify-content: center;
    }

    /* Table inside card scrolling */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    /* Filter bar forms */
    .filter-bar .row > [class*="col-md"] {
        margin-bottom: 0;
    }
}

@media (max-width: 575.98px) {
    .content-area {
        padding: 0.75rem;
    }

    .top-header {
        padding: 0 0.75rem;
        gap: 0.5rem;
    }

    /* Cards */
    .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }

    .card-header h6 {
        font-size: 0.82rem;
    }

    .card-header .btn {
        font-size: 0.78rem;
        padding: 0.3rem 0.65rem;
    }

    /* Dashboard cards */
    .dashboard-card-v2 .card-body {
        padding: 1rem;
    }

    .dashboard-card-v2 .card-body h5 {
        font-size: 1.4rem;
    }

    .dashboard-card-v2 .card-icon {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
        border-radius: 10px;
        margin-bottom: 0.75rem;
    }

    /* Tables */
    .table {
        font-size: 0.8rem;
    }

    .table thead th {
        padding: 0.5rem 0.65rem;
        font-size: 0.7rem;
    }

    .table td {
        padding: 0.5rem 0.65rem;
    }

    /* Modals */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-lg {
        max-width: 100%;
    }

    .modal-header {
        padding: 0.75rem 1rem;
    }

    .modal-body {
        padding: 0.75rem 1rem;
    }

    .modal-footer {
        padding: 0.5rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        flex: 1;
        min-width: 0;
    }

    /* Buttons in tables */
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    /* Alert */
    .alert {
        font-size: 0.82rem;
        padding: 0.65rem 1rem;
    }

    /* User profile button */
    .user-profile-btn {
        padding: 0.25rem 0.5rem;
    }

    .user-avatar {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    /* Filter bars */
    .filter-bar .btn {
        font-size: 0.8rem;
    }

    /* Form elements */
    .form-control,
    .form-select {
        font-size: 0.82rem;
    }

    .form-label {
        font-size: 0.72rem;
    }

    /* Footer */
    .app-footer {
        font-size: 0.72rem;
        padding: 0.75rem 1rem;
    }

    /* Badges */
    .badge {
        font-size: 0.68rem;
    }

    /* Login page */
    .login-card {
        padding: 1.5rem;
    }

    .login-card .brand-title img {
        max-height: 70px;
    }

    .login-card .brand-title h2 {
        font-size: 1.3rem;
    }
}

/* ========== Misc ========== */
.loading-animation {
    display: inline-flex;
    gap: 4px;
}

.loading-animation div {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--fp-primary);
    animation: loading-bounce 0.6s infinite alternate;
}

.loading-animation div:nth-child(2) { animation-delay: 0.2s; }
.loading-animation div:nth-child(3) { animation-delay: 0.4s; }

@keyframes loading-bounce {
    to { transform: translateY(-10px); opacity: 0.3; }
}

/* Badge styles */
.badge-status {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Modal improvements */
.modal-content {
    border: none;
    border-radius: 12px;
}

.modal-header {
    border-bottom: 1px solid var(--fp-border-color);
    padding: 1rem 1.25rem;
}

.modal-footer {
    border-top: 1px solid var(--fp-border-color);
    padding: 0.75rem 1.25rem;
}

/* Sidebar toggle button */
.sidebar-toggle {
    background: transparent;
    border: none;
    font-size: 1.3rem;
    color: var(--fp-text-primary);
    cursor: pointer;
    padding: 0.25rem;
}

/* Scrollbar styling for sidebar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--fp-sidebar-hover);
    border-radius: 4px;
}

/* BS4 compatibility helpers - kept for existing JS that adds these classes */
.ml-2 { margin-left: 0.5rem !important; }
.ml-3 { margin-left: 1rem !important; }
.mr-2 { margin-right: 0.5rem !important; }
.mr-5 { margin-right: 3rem !important; }
.pr-3 { padding-right: 1rem !important; }

/* Table component fix for existing @component('components.table') */
.card.shadow {
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06) !important;
    border-radius: 12px;
    border: none;
}

/* Add user button */
.bt-add-user {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--fp-primary);
    font-weight: 500;
    font-size: 0.85rem;
    text-decoration: none;
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--fp-primary);
    transition: all 0.2s;
}

.bt-add-user:hover {
    background: var(--fp-primary);
    color: #fff;
}

.bt-add-user i {
    font-size: 1rem;
}

/* Access denied page */
.access-denied {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
}

.access-denied h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--fp-danger);
}

/* Linha vermelha for planilha events */
.linha-vermelha {
    color: var(--fp-danger) !important;
}

/* ========== Fade-in Animation ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeInUp 0.4s ease forwards;
}

.content-area .card,
.content-area .page-header,
.content-area .dashboard-card {
    animation: fadeInUp 0.4s ease forwards;
    opacity: 0;
}

.content-area .card:nth-child(1),
.content-area .row .col-xl-3:nth-child(1) .dashboard-card,
.content-area .row .col-lg-4:nth-child(1) .dashboard-card,
.content-area .row .col-sm-6:nth-child(1) .dashboard-card { animation-delay: 0.05s; }
.content-area .card:nth-child(2),
.content-area .row .col-xl-3:nth-child(2) .dashboard-card,
.content-area .row .col-lg-4:nth-child(2) .dashboard-card,
.content-area .row .col-sm-6:nth-child(2) .dashboard-card { animation-delay: 0.1s; }
.content-area .card:nth-child(3),
.content-area .row .col-xl-3:nth-child(3) .dashboard-card { animation-delay: 0.15s; }
.content-area .card:nth-child(4),
.content-area .row .col-xl-3:nth-child(4) .dashboard-card { animation-delay: 0.2s; }
.content-area .row .col-xl-3:nth-child(5) .dashboard-card { animation-delay: 0.25s; }
.content-area .row .col-xl-3:nth-child(6) .dashboard-card { animation-delay: 0.3s; }
.content-area .row .col-xl-3:nth-child(7) .dashboard-card { animation-delay: 0.35s; }
.content-area .row .col-xl-3:nth-child(8) .dashboard-card { animation-delay: 0.4s; }

.content-area .page-header { animation-delay: 0s; }

/* ========== Action Button Hover Effects ========== */
.btn-sm {
    transition: all 0.2s ease;
}

.btn-sm:hover {
    transform: scale(1.08);
}

.btn-sm:active {
    transform: scale(0.95);
}

/* ========== Sidebar Link Hover Icon Shift ========== */
.sidebar-nav .nav-link i {
    transition: transform 0.2s ease;
}

.sidebar-nav .nav-link:hover i {
    transform: translateX(3px);
}

/* ========== Zebra Striping ========== */
.table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: #fafbfc;
}

.table > tbody > tr {
    transition: background-color 0.15s ease;
}

/* ========== Sticky Table Header ========== */
.table-sticky thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-sticky thead th {
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

/* ========== Table Responsive Scroll Indicator ========== */
.table-scroll-wrapper {
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-scroll-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.table-scroll-wrapper.has-scroll::after {
    opacity: 1;
}

/* ========== Empty State ========== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--fp-primary-light);
    color: var(--fp-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.empty-state h6 {
    font-weight: 600;
    color: var(--fp-text-primary);
    margin-bottom: 0.25rem;
}

.empty-state p {
    font-size: 0.85rem;
    color: var(--fp-text-secondary);
    margin: 0;
    max-width: 300px;
}

/* ========== Loading Button State ========== */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.75;
}

.btn-loading .btn-text {
    visibility: hidden;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    margin-left: -9px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

/* ========== File Input Custom ========== */
.file-input-wrapper {
    position: relative;
}

.file-input-wrapper .form-control[type="file"] {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
}

.file-input-wrapper .form-control[type="file"]::file-selector-button {
    background: var(--fp-primary);
    color: #fff;
    border: none;
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-right: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}

.file-input-wrapper .form-control[type="file"]::file-selector-button:hover {
    background: var(--fp-primary-hover);
}

.file-feedback {
    font-size: 0.78rem;
    color: var(--fp-text-secondary);
    margin-top: 0.35rem;
    display: none;
}

.file-feedback.show {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--fp-success);
}

.file-feedback i {
    font-size: 0.9rem;
}

/* ========== Dashboard Cards V2 (Icon-based) ========== */
.dashboard-card-v2 {
    border: none;
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: inherit;
    height: 100%;
    background: var(--fp-card-bg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    position: relative;
}

.dashboard-card-v2:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}

.dashboard-card-v2 .card-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.dashboard-card-v2:hover .card-icon {
    transform: scale(1.1);
}

.dashboard-card-v2 .card-body {
    padding: 1.35rem;
}

.dashboard-card-v2 .card-body h5 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.15rem;
    color: var(--fp-text-primary);
    line-height: 1.2;
}

.dashboard-card-v2 .card-body p {
    font-size: 0.78rem;
    color: var(--fp-text-secondary);
    margin: 0;
}

.dashboard-card-v2:hover .card-body h5 {
    color: var(--fp-primary);
}

.dashboard-card-v2 .card-arrow {
    position: absolute;
    bottom: 1.25rem;
    right: 1.25rem;
    font-size: 1rem;
    color: var(--fp-text-secondary);
    opacity: 0;
    transform: translateX(-6px);
    transition: all 0.3s ease;
}

.dashboard-card-v2:hover .card-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* Icon color variants */
.icon-indigo  { background: #eef2ff; color: #4f46e5; }
.icon-blue    { background: #dbeafe; color: #2563eb; }
.icon-emerald { background: #d1fae5; color: #059669; }
.icon-amber   { background: #fef3c7; color: #d97706; }
.icon-rose    { background: #ffe4e6; color: #e11d48; }
.icon-purple  { background: #f3e8ff; color: #7c3aed; }
.icon-cyan    { background: #cffafe; color: #0891b2; }
.icon-slate   { background: #f1f5f9; color: #475569; }

/* ========== Sidebar Badge ========== */
.sidebar-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-weight: 600;
    background: var(--fp-primary);
    color: #fff;
    margin-left: auto;
    line-height: 1.4;
}

.sidebar-badge-warning {
    background: var(--fp-warning);
    color: #1e293b;
}

/* ========== Sidebar Logo Icon ========== */
.sidebar-brand .brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-brand a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

/* ========== RightPanel Mobile Toggle ========== */
.right-panel-toggle {
    display: none;
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 1050;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--fp-primary);
    color: #fff;
    border: none;
    font-size: 1.2rem;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
    cursor: pointer;
    transition: all 0.2s;
}

.right-panel-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
}

@media (max-width: 991.98px) {
    .right-panel-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .col-lg-3 .competencias-panel {
        display: none;
    }
    .col-lg-3 .competencias-panel.show-mobile {
        display: block;
        position: fixed;
        bottom: 5rem;
        right: 1.25rem;
        width: 280px;
        z-index: 1049;
        box-shadow: 0 10px 40px rgba(0,0,0,0.15);
        max-height: 60vh;
        overflow-y: auto;
        border-radius: 12px;
    }
}

/* ========== Form Select Labels ========== */
.select-with-label {
    position: relative;
}

.select-with-label .form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--fp-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.3rem;
}

/* ========== Table Action Icons (replace SVG) ========== */
.btn-action {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-action:hover {
    transform: scale(1.12);
}

.btn-action:active {
    transform: scale(0.92);
}

/* ========== DataTables Overrides ========== */

/* Top row (length + filter) and bottom row (info + paginate) as flex */
.dataTables_wrapper .row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin: 0;
}

.dataTables_wrapper .row > div {
    float: none !important;
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--fp-border-color);
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--fp-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--fp-border-color);
    border-radius: 8px;
    padding: 0.35rem 2rem 0.35rem 0.6rem;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
}

.dataTables_wrapper .dataTables_length select:focus {
    border-color: var(--fp-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}

.dataTables_wrapper .dataTables_info {
    font-size: 0.8rem;
    color: var(--fp-text-secondary);
    padding-top: 0.75rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    font-size: 0.8rem;
    border-radius: 6px !important;
    margin: 0 2px;
    font-family: 'Inter', sans-serif;
}

/* ==========================================================
   Botão flutuante Scroll Topo/Final
   ========================================================== */
.fp-scroll-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1050;
    transition: opacity 0.25s ease;
}

.fp-scroll-fab .btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1.1rem;
    opacity: 0.75;
    transition: opacity 0.2s ease;
}

.fp-scroll-fab .btn:hover {
    opacity: 1;
}

@media (max-width: 576px) {
    .fp-scroll-fab {
        bottom: 16px;
        right: 16px;
    }

    .fp-scroll-fab .btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

/* ==========================================================
   Barra de busca flutuante (Ctrl+F) — Lançamentos
   ========================================================== */
.fp-search-float {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 1060;
    width: 340px;
    background: var(--fp-card-bg);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px;
    animation: fpSearchSlideIn 0.2s ease;
}

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

.fp-search-float .form-control {
    font-size: 0.8rem;
}

.fp-search-float .btn {
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
}

.fp-search-float #searchCount {
    font-size: 0.75rem;
    min-width: 45px;
    justify-content: center;
}

.fp-search-highlight {
    background-color: #fde68a !important;
}

.fp-search-highlight-active {
    background-color: #f59e0b !important;
    outline: 2px solid #d97706;
}

@media (max-width: 576px) {
    .fp-search-float {
        top: 70px;
        right: 12px;
        left: 12px;
        width: auto;
    }
}
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--fp-primary) !important;
    border-color: var(--fp-primary) !important;
    color: #fff !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--fp-primary-light) !important;
    border-color: var(--fp-primary-light) !important;
    color: var(--fp-primary) !important;
}

.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
}

.dataTables_wrapper .dataTables_paginate {
    padding: 0.75rem 1rem;
}

/* Responsive: stack controls on small screens */
@media (max-width: 767.98px) {
    .dataTables_wrapper .row > div[class*="col-sm"],
    .dataTables_wrapper .row > div[class*="col-md"] {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        text-align: left !important;
    }

    .dataTables_wrapper .dataTables_filter {
        padding: 0 1rem 0.5rem;
    }

    .dataTables_wrapper .dataTables_filter label {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        width: 100%;
    }

    .dataTables_wrapper .dataTables_filter input {
        width: 100% !important;
        margin-left: 0 !important;
    }

    .dataTables_wrapper .dataTables_length {
        padding: 0.75rem 1rem 0.25rem;
    }

    .dataTables_wrapper .dataTables_info {
        text-align: center !important;
        padding: 0.5rem 1rem 0.25rem;
    }

    .dataTables_wrapper .dataTables_paginate {
        text-align: center !important;
        padding: 0.25rem 1rem 0.75rem;
    }

    .dataTables_wrapper .dataTables_paginate .pagination {
        justify-content: center;
        flex-wrap: wrap;
        gap: 2px;
    }
}

@media (max-width: 575.98px) {
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_length {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    .dataTables_wrapper .dataTables_info {
        font-size: 0.72rem;
    }

    .dataTables_wrapper .dataTables_paginate .paginate_button {
        font-size: 0.72rem;
        padding: 0.25rem 0.5rem !important;
        margin: 0 1px;
    }
}

table.dataTable {
    width: 100% !important;
}

table.dataTable thead th {
    border-bottom-color: var(--fp-border-color) !important;
}

table.dataTable.table-hover tbody tr:hover {
    background-color: var(--fp-primary-light) !important;
}

/* Fix DataTables inside card with p-0 */
.card-body.p-0 .dataTables_wrapper .dataTables_filter,
.card-body.p-0 .dataTables_wrapper .dataTables_length {
    padding: 0.75rem 1rem;
}

.card-body.p-0 .dataTables_wrapper .dataTables_info,
.card-body.p-0 .dataTables_wrapper .dataTables_paginate {
    padding: 0.5rem 1rem 0.75rem;
}

/* DataTables scrollX - single scroll for thead+tbody */
.dataTables_scrollBody {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

.dataTables_scrollHead {
    overflow: hidden !important;
}

/* ========== Laravel Pagination (Bootstrap) ========== */
.card-footer .pagination {
    margin: 0;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px;
}

.card-footer .page-link {
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    border-radius: 6px !important;
    border: 1px solid var(--fp-border-color);
    color: var(--fp-text-primary);
    padding: 0.35rem 0.7rem;
}

.card-footer .page-item.active .page-link {
    background-color: var(--fp-primary);
    border-color: var(--fp-primary);
    color: #fff;
}

.card-footer .page-link:hover {
    background-color: var(--fp-primary-light);
    border-color: var(--fp-primary-light);
    color: var(--fp-primary);
}

.card-footer .page-item.disabled .page-link {
    color: var(--fp-text-secondary);
    opacity: 0.5;
}

@media (max-width: 575.98px) {
    .card-footer .page-link {
        font-size: 0.72rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Utilitário: w-md-auto (width auto a partir de md) */
@media (min-width: 768px) {
    .w-md-auto {
        width: auto !important;
    }
}

/* Modal de alerta — acima de tudo */
#modalAlerta {
    z-index: 10060;
}
#modalAlerta + .modal-backdrop,
#modalAlerta ~ .modal-backdrop {
    z-index: 10050;
}

/* ═══════════════════════════════════════════════════════════════
   Overlay de envio TOTVS — Avião de papel
   ═══════════════════════════════════════════════════════════════ */
.overlay-envio-totvs {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.overlay-envio-totvs.active {
    display: flex;
}

.overlay-envio-content {
    text-align: center;
}

.airplane-container {
    width: 220px;
    height: 80px;
    margin: 0 auto 1.5rem;
    position: relative;
    overflow: hidden;
}

.airplane-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%) rotate(-15deg);
    animation: flyAcross 2s ease-in-out infinite;
}

@keyframes flyAcross {
    0% {
        left: -60px;
        opacity: 0;
        top: 60%;
    }
    15% {
        opacity: 1;
    }
    50% {
        top: 35%;
    }
    85% {
        opacity: 1;
    }
    100% {
        left: 230px;
        opacity: 0;
        top: 55%;
    }
}

.overlay-envio-text {
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.overlay-envio-subtext {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    margin: 0;
}

/* ==========================================================
   Tooltip sidebar collapsed (JS-based, posicionado no body)
   ========================================================== */
.fp-sidebar-tooltip {
    position: fixed;
    background: #1e293b;
    color: #fff;
    font-size: 0.78rem;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    pointer-events: none;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.fp-sidebar-tooltip.show {
    opacity: 1;
}
