/* style.css */

/* --- General Styles & Variables --- */
:root {
  --primary-color: #0d6efd; /* Bootstrap 5 primary blue */
  --secondary-color: #6c757d; /* Bootstrap secondary gray */
  --success-color: #198754; /* Bootstrap 5 success green */
  --danger-color: #dc3545; /* Bootstrap danger red */
  --warning-color: #ffc107; /* Bootstrap warning yellow */
  --info-color: #0dcaf0; /* Bootstrap 5 info cyan */
  --light-color: #f8f9fa; /* Bootstrap light gray */
  --dark-color: #212529; /* Bootstrap 5 dark gray */
  --background-color: #f8f9fa; /* Light gray background for a softer look */
  --text-color: #212529; /* Default text color */
  --navbar-bg: var(--primary-color);
  --navbar-text: #ffffff;
  --link-color: var(--primary-color);
  --link-hover-color: #0a58ca; /* Darker blue for hover */
  --font-family-sans-serif: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  --border-radius: 0.375rem; /* Bootstrap 5 default */
  --box-shadow-sm: 0 .125rem .25rem rgba(0, 0, 0, .075);
  --box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15);
}

body {
  font-family: var(--font-family-sans-serif);
  /* background-image: linear-gradient(to bottom right, #eef2f7, #d0d9e3); */ /* Replaced with image */
  background-image: linear-gradient(rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.85)), url('../img/background.jpg'); /* Image with white overlay */
  background-size: cover;
  background-position: center center;
  background-attachment: fixed; /* Keeps the background fixed during scroll */
  background-repeat: no-repeat;
  color: var(--text-color);
  line-height: 1.6;
  padding-top: 70px; /* Add padding to prevent content from hiding behind fixed navbar */
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 500;
  margin-bottom: 0.75rem;
  color: var(--dark-color);
}

h1.display-4 {
    font-weight: 300; /* Lighter weight for display headings */
    margin-bottom: 2rem; /* More space below main headings */
    text-align: center; /* Center the main title */
    color: var(--primary-color);
}

a {
  color: var(--link-color);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover-color);
  text-decoration: underline;
}

.container {
    max-width: 1140px; /* Standard container width */
    background-color: #ffffff; /* White background for content area */
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-top: 2rem; /* Add space below navbar */
    margin-bottom: 2rem;
}

/* --- Navbar --- */
.navbar {
  background-color: var(--navbar-bg) !important; /* Override potential inline styles */
  box-shadow: var(--box-shadow-sm);
  position: fixed; /* Make navbar fixed */
  top: 0;
  width: 100%;
  z-index: 1030; /* Ensure navbar stays on top */
}

.navbar-brand img {
  /* Logo likely has transparency, no filter needed unless it's dark on dark */
}

.navbar-dark .navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.85);
  padding: 0.8rem 1rem;
  transition: color 0.2s ease-in-out, background-color 0.2s ease-in-out;
  border-radius: var(--border-radius);
  margin: 0 0.25rem;
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link.active {
  color: var(--navbar-text);
  background-color: rgba(255, 255, 255, 0.1);
}

.navbar-dark .navbar-nav .nav-link.active {
    font-weight: 500;
}

.navbar-toggler {
    border-color: rgba(255, 255, 255, 0.2);
}

.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, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}


/* --- Forms --- */
.form-control, .form-select {
  border-radius: var(--border-radius);
  border: 1px solid #ced4da;
  padding: 0.5rem 0.75rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  margin-bottom: 1rem; /* Add space below form elements */
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25); /* Use Bootstrap 5 focus color */
  outline: 0;
}

/* Remove bottom margin from last form element in a row */
.row > div > *:last-child {
    margin-bottom: 0;
}

/* --- Buttons --- */
.btn {
  border-radius: var(--border-radius);
  padding: 0.5rem 1rem;
  font-weight: 500;
  transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, transform 0.1s ease-in-out;
  display: inline-flex; /* Align icon and text */
  align-items: center;
  justify-content: center;
}

.btn:active {
    transform: scale(0.98); /* Slight shrink effect on click */
}

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

.btn-primary:hover {
  background-color: #0b5ed7; /* Darker shade for hover */
  border-color: #0a58ca;
  color: #fff;
}

.btn-warning { /* For the search button */
    background-color: var(--warning-color);
    border-color: var(--warning-color);
    color: var(--dark-color); /* Better contrast */
}

.btn-warning:hover {
    background-color: #ffca2c;
    border-color: #ffc720;
    color: var(--dark-color);
}

.btn i {
    margin-right: 0.35rem; /* Space between icon and text */
    vertical-align: middle;
}

.btn i.fa-plus, .btn i.fa-search {
    margin-right: 0; /* No margin if only icon */
}

/* Make buttons full width on small screens */
@media (max-width: 767.98px) {
    .d-flex.justify-content-end .btn {
        width: 100%;
        margin-top: 0.5rem;
    }
}

/* --- Modal --- */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--box-shadow);
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
    color: #fff; /* White text for colored headers */
}

.modal-header .btn-close {
    padding: 0.5rem;
    margin: -0.5rem -0.5rem -0.5rem auto;
    filter: invert(1) grayscale(100%) brightness(200%); /* Make close button white */
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 500;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
    justify-content: flex-end; /* Align button to the right */
}

/* Custom modal header colors based on JS */
.modal-header.bg-success { /* Use background class */
    background-color: var(--success-color);
}
.modal-header.bg-danger { /* Use background class */
    background-color: var(--danger-color);
}

/* Custom modal button colors based on JS */
.modal-footer .btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: #fff;
}
.modal-footer .btn-success:hover {
    background-color: #157347;
    border-color: #146c43;
    color: #fff;
}
.modal-footer .btn-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    color: #fff;
}
.modal-footer .btn-danger:hover {
    background-color: #bb2d3b;
    border-color: #b02a37;
    color: #fff;
}


/* --- Table (Consulta Page) --- */
.table {
    margin-top: 1.5rem;
    border: 1px solid #dee2e6;
    box-shadow: var(--box-shadow-sm);
    border-collapse: separate; /* Needed for border-radius on table */
    border-spacing: 0;
    overflow: hidden; /* Clip content to border-radius */
    border-radius: var(--border-radius);
}

.table thead th {
    background-color: var(--light-color);
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    padding: 0.75rem 1rem;
    vertical-align: middle;
    text-align: left;
    color: var(--secondary-color);
    text-transform: uppercase;
    font-size: 0.9em;
}

.table tbody tr:nth-of-type(odd) {
    background-color: #f8f9fa; /* Subtle striping */
}

.table tbody tr:hover {
    background-color: #e9ecef; /* Highlight on hover */
}

.table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-top: 1px solid #dee2e6; /* Add top border to cells */
}

.table tbody tr:first-child td {
    border-top: none; /* Remove top border for first row */
}

.table .btn-danger { /* Style for delete button in table */
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    line-height: 1.2;
    background-color: transparent;
    border: none;
    color: var(--danger-color);
}

.table .btn-danger:hover {
    background-color: var(--danger-color);
    color: #fff;
}

/* --- Responsiveness --- */

/* Adjust container padding on smaller screens */
@media (max-width: 575.98px) {
    .container {
        padding: 1rem;
    }
    h1.display-4 {
        font-size: 2rem;
    }
    body {
        padding-top: 56px; /* Adjust for smaller navbar height */
    }
}

/* Responsive Table Styling */
@media (max-width: 767.98px) {
    .table-responsive {
        border: none; /* Remove border from wrapper */
        box-shadow: none;
    }
    .table thead {
        display: none; /* Hide table header on small screens */
    }
    .table tbody, .table tr, .table td {
        display: block;
        width: 100%;
    }
    .table tr {
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: var(--border-radius);
        overflow: hidden; /* Clip td borders */
    }
    .table td {
        text-align: right; /* Align text to the right */
        padding-left: 50%; /* Make space for the label */
        position: relative;
        border: none;
        border-bottom: 1px solid #eee;
        min-height: 38px; /* Ensure consistent height */
        display: flex; /* Use flex for better alignment */
        align-items: center;
        justify-content: flex-end;
    }
    .table td::before {
        content: attr(data-label); /* Use data-label for pseudo-header */
        position: absolute;
        left: 10px;
        width: calc(50% - 20px);
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: var(--secondary-color);
    }
     .table td:last-child {
        border-bottom: 0;
    }
    /* Adjust delete button position */
    .table td:last-child .btn {
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
    }
}

/* --- Utility Classes --- */
.flex {
    display: flex;
    align-items: center;
}

