:root {
    /* Light theme colors */
    --body-bg: #f8f9fa;
    --text-color: #212529;
    --card-bg: #ffffff;
    --border-color: #dee2e6;
    --input-bg: #ffffff;
    --input-text: #212529;
    --table-header-bg: #e9ecef;
    --table-row-bg: #ffffff;
    --table-striped-bg: #f2f2f2;
    --resolved-bg: #e9ffe9; /* Light mode resolved background */
    --thin-border: 1px solid var(--border-color);
}

body.dark-mode {
    /* Dark theme colors */
    --body-bg: #343a40;
    --text-color: #f8f9fa;
    --card-bg: #495057;
    --border-color: rgba(255, 255, 255, 0.5); /* Thin white border */
    --input-bg: #6c757d;
    --input-text: #f8f9fa;
    --table-header-bg: #212529;
    --table-row-bg: #495057;
    --table-striped-bg: #5a6268;
    --resolved-bg: #2E7D32; /* Dark mode resolved background */
    --thin-border: 1px solid rgba(255, 255, 255, 0.5);
}

body {
    background-color: var(--body-bg) !important;
    color: var(--text-color) !important;
    transition: background-color 0.3s, color 0.3s;
}

/* General elements */
.container, .card, .form-container, .modal-content, .modal-header, .modal-body, .modal-footer {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

/* Form elements */
.form-control, .form-select, .form-check-input {
    background-color: var(--input-bg) !important;
    color: var(--input-text) !important;
    border: var(--thin-border) !important; /* Apply thin border */
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

.form-check-input:checked {
    background-color: #0d6efd !important;
    border-color: #0a58ca !important;
}

body.dark-mode .form-check-input:checked {
    background-color: #66b2ff !important;
    border-color: #66b2ff !important;
}

.form-control::placeholder {
    color: var(--input-text) !important;
    opacity: 0.7 !important;
}

/* Tables */
.table {
    color: var(--text-color) !important;
    border: var(--thin-border) !important; /* Apply thin border to table */
}

.table th, .table td {
    border: var(--thin-border) !important; /* Apply thin border to cells */
    background-color: var(--table-row-bg) !important; /* Ensure cell background is themed */
    color: var(--text-color) !important; /* Ensure cell text is themed */
}

.table thead {
    background-color: var(--table-header-bg) !important;
    color: var(--text-color) !important;
}

.table-striped tbody tr:nth-of-type(odd) td { /* Target td within striped rows */
    background-color: var(--table-striped-bg) !important;
}

.table-striped tbody tr:nth-of-type(even) td { /* Target td within striped rows */
    background-color: var(--table-row-bg) !important;
}

/* Override specific Bootstrap classes if necessary */
.table-light { /* This class is used in admin.html for thead */
    background-color: var(--table-header-bg) !important;
    color: var(--text-color) !important;
}

/* Ensure table hover effect is also themed */
.table-hover tbody tr:hover {
    background-color: var(--table-striped-bg) !important; /* Use a slightly different background for hover */
}

/* Ensure the resolved row background is applied to all cells */
tr.resuelta td {
    background-color: var(--resolved-bg) !important;
    color: var(--text-color) !important;
    text-decoration: line-through !important;
}

/* Alerts */
.alert {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

/* Specific for login.html body class */
body.dark-mode.bg-light {
    background-color: var(--body-bg) !important;
}

/* Ensure text in modals is also themed */
.modal-header, .modal-body, .modal-footer {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

/* Ensure links are visible */
a {
    color: var(--text-color) !important;
}

/* New styles for the incidencias table */
.table-responsive-container {
    max-height: 70vh; /* Set a maximum height for vertical scrolling */
    overflow-x: auto;
    overflow-y: auto; /* Enable vertical scrolling */
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 1rem;
}

.incidencias-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-color);
}

.incidencias-table th,
.incidencias-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
}

.incidencias-table th:nth-child(9),
.incidencias-table td:nth-child(9) {
    width: 50%;
}

.incidencias-table thead th {
    background-color: var(--table-header-bg);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky; /* Make header sticky */
    top: 0; /* Stick to the top of the container */
    z-index: 10; /* Ensure it stays above other content */
}

.incidencias-table tbody tr {
    background-color: var(--table-row-bg);
    transition: background-color 0.2s ease-in-out;
}

.incidencias-table tbody tr:hover {
    background-color: var(--table-striped-bg);
}

.incidencias-table img {
    border-radius: 0.25rem;
}

@media (max-width: 768px) {
    .incidencias-table {
        min-width: 800px;
    }
}

/* Animated background for login */
.area {
    background: #4e54c8;
    background: -webkit-linear-gradient(to left, #8f94fb, #4e54c8);
    width: 100%;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
}

.circles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.circles li {
    position: absolute;
    display: block;
    list-style: none;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    animation: animate 25s linear infinite;
    bottom: -150px;
}

.circles li:nth-child(1) {
    left: 25%;
    width: 80px;
    height: 80px;
    animation-delay: 0s;
}

.circles li:nth-child(2) {
    left: 10%;
    width: 20px;
    height: 20px;
    animation-delay: 2s;
    animation-duration: 12s;
}

.circles li:nth-child(3) {
    left: 70%;
    width: 20px;
    height: 20px;
    animation-delay: 4s;
}

.circles li:nth-child(4) {
    left: 40%;
    width: 60px;
    height: 60px;
    animation-delay: 0s;
    animation-duration: 18s;
}

.circles li:nth-child(5) {
    left: 65%;
    width: 20px;
    height: 20px;
    animation-delay: 0s;
}

.circles li:nth-child(6) {
    left: 75%;
    width: 110px;
    height: 110px;
    animation-delay: 3s;
}

.circles li:nth-child(7) {
    left: 35%;
    width: 150px;
    height: 150px;
    animation-delay: 7s;
}

.circles li:nth-child(8) {
    left: 50%;
    width: 25px;
    height: 25px;
    animation-delay: 15s;
    animation-duration: 45s;
}

.circles li:nth-child(9) {
    left: 20%;
    width: 15px;
    height: 15px;
    animation-delay: 2s;
    animation-duration: 35s;
}

.circles li:nth-child(10) {
    left: 85%;
    width: 150px;
    height: 150px;
    animation-delay: 0s;
    animation-duration: 11s;
}

@keyframes animate {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
        border-radius: 0;
    }
    100% {
        transform: translateY(-1000px) rotate(720deg);
        opacity: 0;
        border-radius: 50%;
    }
}
