/* Custom Button Styles */
.btn-primary,
.btn-secondary,
.btn-success, /* Apply to green buttons too? */
.btn-info,    /* Apply to cyan buttons too? */
.btn-warning, /* Apply to yellow buttons too? */
.btn-danger,  /* Apply to red buttons too? */
.btn-outline-secondary /* Style outline buttons if desired */ {
    background-color: #0090d5 !important; /* Use !important to override Bootstrap */
    border-color: #0090d5 !important;
    color: #ffffff !important; /* Ensure text is readable */
}

/* Optional: Style for hover/focus states */
.btn-primary:hover, .btn-primary:focus,
.btn-secondary:hover, .btn-secondary:focus,
.btn-success:hover, .btn-success:focus,
.btn-info:hover, .btn-info:focus,
.btn-warning:hover, .btn-warning:focus,
.btn-danger:hover, .btn-danger:focus,
.btn-outline-secondary:hover, .btn-outline-secondary:focus {
    background-color: #007bbd !important; /* Slightly darker shade for hover/focus */
    border-color: #007bbd !important;
    color: #ffffff !important;
}

/* Adjust outline button text color when not hovered */
.btn-outline-secondary {
     color: #0090d5 !important;
}
.btn-outline-secondary:hover {
     color: #ffffff !important; /* Text becomes white on hover */
}

/* Custom Checkbox Color */
.form-check-input:checked {
    background-color: #0090d5 !important;
    border-color: #0090d5 !important;
}

/* Custom Navbar Styling */
.navbar.bg-light { /* Target the specific navbar */
    background-color: #0090d5 !important;
}

.navbar.bg-light .navbar-brand,
.navbar.bg-light .nav-link,
.navbar.bg-light .navbar-text {
    color: #ffffff !important; /* White text for links and text */
}

/* Ensure dropdown items are readable if dropdown background is inherited */

/* Style the toggler icon for better visibility on dark background */
.navbar.bg-light .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

.navbar.bg-light .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.5) !important; /* Lighter border for toggler */
}

/* Prevent horizontal scroll — must be on html to avoid breaking Safari fixed positioning */
html {
    overflow-x: hidden;
}

/* Add padding to body top and set positioning for background */
body {
    padding-top: 70px; /* Adjust based on actual navbar height */
    position: relative; /* Needed for z-index stacking context */
}

/* Top Left Fixed Logo */
#top-left-logo {
    position: fixed;
    top: 2px; /* Adjust spacing from top */
    left: 4px; /* Adjust spacing from left */
    width: auto; /* Set desired width */
    height: 52px; /* Maintain aspect ratio */
    z-index: 1031; /* Ensure it's above navbar if needed, adjust if overlaps */
    opacity: 1; /* Make it fully visible */
    pointer-events: none; /* Make it non-interactive if it overlaps clickable elements */
}

/* Make Navbar Fixed */
.navbar {
    position: fixed; /* Fix to the viewport */
    top: 0; /* Position at the very top */
    left: 0; /* Align to the left edge */
    right: 0; /* Align to the right edge (ensures full width) */
    width: 100%; /* Explicit width needed for Safari */
    z-index: 1030; /* High z-index to stay on top */
    /* background-color is already set */
}


/* On large screens, add left padding to navbar to clear the fixed logo */
@media (min-width: 992px) {
    .navbar .container-fluid {
        padding-left: 300px;
    }
}

/* Hide top-left logo on smaller screens (Bootstrap lg breakpoint is 992px) */
@media (max-width: 991.98px) {
    #top-left-logo {
        display: none;
    }
}

/* Fixed Background Image */
body::before {
    content: ""; /* Required for pseudo-elements */
    position: fixed; /* Fixed position relative to the viewport */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../../includes/logo.png'); /* Corrected path relative to custom.css */
    background-repeat: no-repeat; /* Do not tile the image */
    background-position: center center; /* Center the image */
    background-size: contain; /* Fit the entire image within its container, maintain aspect ratio */
    opacity: 0.05; /* 5% opacity */
    z-index: -1; /* Place it behind all other content */
    pointer-events: none; /* Make sure it doesn't interfere with clicks */
}

/* --- Lightbox Styles --- */
.lightbox-trigger {
    cursor: pointer; /* Indicate it's clickable */
    transition: opacity 0.2s ease-in-out;
}

.lightbox-trigger:hover {
    opacity: 0.8;
}

.lightbox-overlay {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1060; /* Sit on top (higher than default Bootstrap modal z-index 1050) */
    padding-top: 50px; /* Location of the box */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.85); /* Black w/ opacity */
}

.lightbox-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 85vh; /* Limit height to viewport height minus some padding */
    object-fit: contain; /* Scale the image while preserving aspect ratio */
}

.lightbox-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 1061; /* Ensure close button is above the image */
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* --- Dark Mode Styles --- */
body.dark-mode {
    background-color: #121212;
    color: #ffffff;
}

body.dark-mode::before {
    opacity: 0.1;
    filter: invert(1);
}

.dark-mode .table-responsive {
    filter: invert(1);
}

.dark-mode .table-responsive .badge {
    filter: invert(1);
}

.dark-mode .table-responsive .btn {
    filter: invert(1);
}

.dark-mode .footer-text {
    color: #ffffff !important;
}

.dark-mode .modal-content {
    background-color: #2b2b2b;
    color: #ffffff;
}

.dark-mode .modal-content .bg-light {
    background-color: #3a3a3a !important;
    color: #ffffff;
}

.dark-mode .modal-content .text-muted {
    color: #bbbbbb !important;
}

.dark-mode .modal-header,
.dark-mode .modal-footer {
    border-color: #444444;
}

.dark-mode .modal-content .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* --- Última limpeza status text (cashlogy_editar) --- */
/* Light mode: verde = limpa há menos de 6 meses, amarelo = há 6 meses ou mais.
   Fundo inalterado, apenas a cor do texto (span). */
.ult-limp-ok  { color: #198754 !important; font-weight: 600; }
.ult-limp-old { color: #b8860b !important; font-weight: 600; }

/* Dark mode: a .table-responsive é invertida (filter: invert(1)). Contra-invertemos
   apenas o span (fundo transparente), por isso o fundo da célula mantém-se preto e
   só o texto muda de cor. Verde mais claro para contrastar com o fundo preto. */
.dark-mode .table-responsive .ult-limp-ok,
.dark-mode .table-responsive .ult-limp-old {
    filter: invert(1);
}
.dark-mode .table-responsive .ult-limp-ok  { color: #5dd879 !important; }
.dark-mode .table-responsive .ult-limp-old { color: #ffd24d !important; }