/* ================================
   CareLedger Global Theme
   Accessible • Modern • Dyslexia-friendly
   ================================ */

/* ------------------------------
   Base Light Mode
   ------------------------------ */
body {
    font-family: 'Arial', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    background-color: #adb0b4;
    color: #212529;
    overflow-y: scroll; /* always reserve scrollbar space */
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #0d6efd;
}

/* ------------------------------
   Navbar (Light Mode)
   ------------------------------ */
.navbar {
    background: linear-gradient(90deg, #084298, #0d6efd);
    color: #fff;
}
.navbar a, .navbar .navbar-brand, .navbar .nav-link { color: #fff; }
.navbar a:hover, .navbar .nav-link:hover { color: #e0e0e0; }

/* ------------------------------
   Cards & Dashboard Cards
   ------------------------------ */
.card, .dashboard-card {
    border-radius: 1rem;
    border: none;
    background: #fff;
    color: #212529;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover, .modal .card:hover { transform: translateY(-3px); box-shadow: 0 8px 16px rgba(0,0,0,0.2); }

.card-header, .header-gradient {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 1rem 1.25rem;
    border-radius: 1rem 1rem 0 0;
}
.header-gradient { background: linear-gradient(90deg, #084298, #0d6efd); color: #fff; }
.header-gradient * { color: #fff !important; }

.dashboard-card {
    padding: 1rem;
    height: 100%;
    border: 1px solid rgba(0,0,0,0.15);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}
.dashboard-card:hover, .modal .dashboard-card:hover { transform: translateY(-4px); box-shadow: 0 12px 24px rgba(0,0,0,0.2); }
.dashboard-card h6 { font-weight: 700; color: #0d6efd; margin-bottom: 0.5rem; }
.dashboard-card a { color: #0d6efd; text-decoration: underline; }
.dashboard-card a:hover { color: #0a58ca; text-decoration: none; }

/* ------------------------------
   Tables
   ------------------------------ */
.table { font-size: 1rem; border-spacing: 0 0.5rem; }
.table th { font-size: 0.85rem; font-weight: 700; background-color: #f1f3f5; color: #212529; padding: 0.75rem; }
.table td { vertical-align: middle; padding: 0.9rem 0.75rem; }
.table-hover tbody tr:hover { background-color: #e9f5ff; }

/* ------------------------------
   Links
   ------------------------------ */
a { color: #0d6efd; text-decoration: none; }
a:hover { color: #0a58ca; text-decoration: none; }

/* ------------------------------
   Buttons
   ------------------------------ */
.btn {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    border-radius: 50rem;
    transition: all 0.2s ease-in-out;
}
.btn-primary { background: linear-gradient(90deg, #0d6efd, #0dcaf0); border: none; color: #fff; }
.btn-primary:hover, .btn-primary:focus { background: linear-gradient(90deg, #0b5ed7, #0bbfda); transform: translateY(-1px); }
.btn-warning { background-color: #6f42c1; color: #fff; border: none; }
.btn-warning:hover, .btn-warning:focus { background-color: #5a32a3; transform: translateY(-1px); }
.btn-danger { background-color: #dc3545; color: #fff; border: none; }
.btn-danger:hover, .btn-danger:focus { background-color: #b02a37; transform: translateY(-1px); }
.btn-outline-primary { background-color: transparent; border: 2px solid #0d6efd; color: #0d6efd; }
.btn-outline-primary:hover, .btn-outline-primary:focus { background-color: #0d6efd; color: #fff; transform: translateY(-1px); }

/* ------------------------------
   Inputs & Forms
   ------------------------------ */
input, textarea, select {
    border: 1px solid #ced4da;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    transition: all 0.2s ease;
    background-color: #fff;
    color: #212529;
}

input:focus, textarea:focus, select:focus {
    border-color: #0d6efd;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(13,110,253,0.25);
}

/* ------------------------------
   Dropdowns
   ------------------------------ */
.dropdown-menu {
    background-color: #fff; 
    color: #212529; 
    border: 1px solid #dee2e6; 
    border-radius: 0.5rem; 
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.1);
}

.dropdown-item { color: #212529 !important; opacity: 1 !important; }
.dropdown-item:hover, .dropdown-item:focus { background-color: #e9f5ff; color: #0d6efd; }
.dropdown-item.text-danger { color: #dc3545; }
.dropdown-item.text-success { color: #198754; }
.dropdown-item.text-danger:hover, .dropdown-item.text-danger:focus { background-color: #b02a37; color: #fff; }
.dropdown-item.text-success:hover, .dropdown-item.text-success:focus { background-color: #145c2a; color: #fff; }
.dropdown-divider { border-color: #dee2e6; }

/* ------------------------------
   Alerts
   ------------------------------ */
.alert {
  border-radius: 12px;
  padding: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  transition: all 0.3s ease-in-out;
  opacity: 0;
  animation: fadeInAlert 0.6s forwards;
}

@keyframes fadeInAlert { to { opacity: 1; } }

body:not(.dark-mode) .alert-success { background: #e6f9ee; border: 1px solid #b2ebcd; color: #1e6b3d; }
body:not(.dark-mode) .alert-info { background: #e7f3fe; border: 1px solid #b6daff; color: #084298; }
body:not(.dark-mode) .alert-warning { background: #fff4e5; border: 1px solid #ffe0b3; color: #8a4d00; }
body:not(.dark-mode) .alert-error, body:not(.dark-mode) .alert-danger { background: #fdecea; border: 1px solid #f5c2c0; color: #842029; }

body.dark-mode .alert-success { background: #123724; border: 1px solid #1f5135; color: #9be7ba; }
body.dark-mode .alert-info { background: #10293d; border: 1px solid #1e4c73; color: #6cb2ff; }
body.dark-mode .alert-warning { background: #3d2b00; border: 1px solid #735c1e; color: #ffd580; }
body.dark-mode .alert-error, body.dark-mode .alert-danger { background: #3d0a0a; border: 1px solid #732626; color: #ff9c9c; }

/* ------------------------------
   Modal / Flicker Fixes
   ------------------------------ */
body.modal-open {
    overflow: hidden !important;
    padding-right: 0 !important;
}

/* Disable hover/focus on background while modal open */
body.modal-open > :not(.modal):not(.modal-backdrop) .card:hover,
body.modal-open > :not(.modal):not(.modal-backdrop) .dashboard-card:hover,
body.modal-open > :not(.modal):not(.modal-backdrop) .btn:hover,
body.modal-open > :not(.modal):not(.modal-backdrop) .btn:focus {
    transform: none !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1) !important;
}

/* Disable pointer events on background */
body.modal-open > :not(.modal):not(.modal-backdrop) {
    pointer-events: none;
}

/* Keep hover/focus inside modal */
.modal .card:hover,
.modal .dashboard-card:hover,
.modal .btn:hover,
.modal .btn:focus {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

/* Modal backdrop */
.modal-backdrop.show { opacity: 0.5; }

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

.dark-mode h1, .dark-mode h2, .dark-mode h3, .dark-mode h4, .dark-mode h5, .dark-mode h6 { color: #90caf9 !important; }

.dark-mode .navbar { background: linear-gradient(90deg, #0b3d91, #0d4fff); }
.dark-mode .navbar a, .dark-mode .navbar .navbar-brand, .dark-mode .navbar .nav-link { color: #fff; }
.dark-mode .navbar a:hover, .dark-mode .navbar .nav-link:hover { color: #90caf9; }

.dark-mode .card, .dark-mode .dashboard-card { background: #1e1e1e; border: 1px solid #333; color: #e0e0e0; }
.dark-mode .card-header, .dark-mode .header-gradient { background: linear-gradient(90deg, #0b3d91, #0d4fff); color: #fff; }
.dark-mode .header-gradient * { color: #fff !important; }

.dark-mode .table, .dark-mode .table td, .dark-mode .table th,
.dark-mode .table tbody tr { background-color: #1e1e1e !important; color: #e0e0e0 !important; border-bottom: 1px solid #333; }
.dark-mode .table-hover tbody tr:hover { background-color: #333 !important; }
.dark-mode .table a, .dark-mode .table a:visited { color: #add8ff !important; }

/* Dark mode inputs */
.dark-mode input, .dark-mode textarea, .dark-mode select {
    background-color: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #444;
}

.dark-mode input:focus, .dark-mode textarea:focus, .dark-mode select:focus {
    border-color: #0bbfda;
    box-shadow: 0 0 0 0.2rem rgba(11,191,218,0.25);
    outline: none;
}

/* Dark mode buttons */
.dark-mode .btn-primary { background: linear-gradient(90deg, #0b5ed7, #0bbfda); color: #fff !important; }
.dark-mode .btn-outline-primary { border-color: #90caf9; color: #90caf9 !important; }
.dark-mode .btn-outline-primary:hover { background-color: #90caf9; color: #121212 !important; }

/* Dark mode dropdowns */
.dark-mode .dropdown-menu,
.dark-mode .dropdown-menu.show { background-color: #1e1e1e !important; color: #e0e0e0 !important; border: 1px solid #333 !important; box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.5) !important; }
.dark-mode .dropdown-item { color: #e0e0e0 !important; }
.dark-mode .dropdown-item:hover,
.dark-mode .dropdown-item:focus { background-color: #333 !important; color: #90caf9 !important; }
.dark-mode .dropdown-item.text-danger:hover,
.dark-mode .dropdown-item.text-danger:focus { background-color: #b02a37 !important; color: #fff !important; }
.dark-mode .dropdown-item.text-success:hover,
.dark-mode .dropdown-item.text-success:focus { background-color: #198754 !important; color: #fff !important; }
.dark-mode .dropdown-divider { border-color: #444 !important; }

/* Dark mode modal */
.dark-mode .modal-content { background-color: #1e1e1e; color: #e0e0e0; border: 1px solid #333; }
.dark-mode .modal-header, .dark-mode .modal-footer { border-color: #333; }
.dark-mode .modal-title { color: #90caf9; }
.dark-mode .modal-body { color: #e0e0e0; }
.dark-mode .modal button.close, .dark-mode .modal .btn-close { filter: invert(1); }
.dark-mode .modal .btn-primary { background: linear-gradient(90deg, #0b5ed7, #0bbfda); border: none; color: #fff; }
.dark-mode .modal .btn-secondary { background-color: #555; border: none; color: #e0e0e0; }
.dark-mode .modal .btn-danger { background-color: #dc3545; border: none; color: #fff; }

/* Table responsiveness */
.table-responsive { overflow-x: auto; overflow-y: hidden; }

/* ================================
   Recurrence Card Styling
   ================================ */
.recurrence-card {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 0.75rem;
    padding: 1rem;
    background-color: #f8f9fa; /* light mode background */
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.recurrence-card h5 {
    font-weight: 700;
    margin-bottom: 1rem;
    color: #0d6efd;
}

/* Inputs inside recurrence card */
.recurrence-card input,
.recurrence-card select {
    background-color: #fff;
    color: #212529;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.5rem;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.recurrence-card input:focus,
.recurrence-card select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13,110,253,0.25);
    outline: none;
}

/* Dark Mode */
.dark-mode .recurrence-card {
    background-color: #1e1e1e;
    border: 1px solid #333;
    box-shadow: inset 0 1px 3px rgba(255,255,255,0.05);
    color: #e0e0e0;
}

.dark-mode .recurrence-card h5 {
    color: #90caf9;
}

.dark-mode .recurrence-card input,
.dark-mode .recurrence-card select {
    background-color: #2c2c2c;
    color: #e0e0e0;
    border: 1px solid #555;
}

.dark-mode .recurrence-card input:focus,
.dark-mode .recurrence-card select:focus {
    border-color: #90caf9;
    box-shadow: 0 0 0 0.2rem rgba(144,202,249,0.25);
    outline: none;
}
/* ================================
   Dark Mode Select Dropdowns
   ================================ */

/* Base select styling for dark mode (recurrence card & general) */
.dark-mode select {
    background-color: #2c2c2c;  /* dark background */
    color: #e0e0e0;             /* light text */
    border: 1px solid #555;
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    appearance: none;           /* remove default arrow in some browsers */
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Focus state */
.dark-mode select:focus {
    border-color: #90caf9;
    box-shadow: 0 0 0 0.2rem rgba(144,202,249,0.25);
    outline: none;
}

/* Option styling */
.dark-mode select option {
    background-color: #2c2c2c; /* match select background */
    color: #e0e0e0;            /* light text */
}

/* Optional: Custom arrow inside recurrence card */
.recurrence-card select {
    padding-right: 2rem; /* make space for arrow */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D'10'%20height%3D'10'%20viewBox%3D'0%200%2010%2010'%20xmlns%3D'http://www.w3.org/2000/svg'%3E%3Cpolygon%20points%3D'0,0%2010,0%205,5'%20fill%3D'%23e0e0e0'/%3E%3C/svg%3E"); 
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 0.65rem;
}
/* ================================
   Pagination
   ================================ */

/* Base pagination container */
.pagination {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0.5rem 0;
    margin: 1rem 0;
    justify-content: center;
}

/* Pagination items */
.pagination li {
    margin: 0 0.25rem;
}

/* Pagination links */
.pagination a, .pagination span {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #ced4da;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
    min-width: 36px;
    text-align: center;
}

/* Light mode */
body:not(.dark-mode) .pagination a {
    background-color: #fff;
    color: #0d6efd;
    border: 1px solid #ced4da;
}

body:not(.dark-mode) .pagination a:hover,
body:not(.dark-mode) .pagination a:focus {
    background-color: #0d6efd;
    color: #fff;
    border-color: #0b5ed7;
}

body:not(.dark-mode) .pagination .active span {
    background-color: #0d6efd;
    color: #fff;
    border-color: #0b5ed7;
}

body:not(.dark-mode) .pagination .disabled span {
    color: #6c757d;
    background-color: #f8f9fa;
    border-color: #ced4da;
    cursor: not-allowed;
}

/* Dark mode */
body.dark-mode .pagination a {
    background-color: #2a2a2a;
    color: #90caf9;
    border: 1px solid #555;
}

body.dark-mode .pagination a:hover,
body.dark-mode .pagination a:focus {
    background-color: #90caf9;
    color: #121212;
    border-color: #90caf9;
}

body.dark-mode .pagination .active span {
    background-color: #90caf9;
    color: #121212;
    border-color: #90caf9;
}

body.dark-mode .pagination .disabled span {
    color: #888;
    background-color: #1e1e1e;
    border-color: #555;
    cursor: not-allowed;
}
