@import url('https://fonts.googleapis.com/css2?family=Kantumruy+Pro:ital,wght@0,100..700;1,100..700&display=swap');

:root {
    --primary-color: #4A90E2;
    --secondary-color: #357ABD;
    --dark-color: #2c3e50;
    --light-color: #f8f9fa;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --neutral-color: #bdc3c7;
    --success-hover-color: #27ae60;
    --danger-hover-color: #c0392b;
    --warning-bg-color: #fdf3e1;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 80px;
    --header-height: 70px;
    --border-radius: 8px;
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-strong: 0 6px 20px rgba(0, 0, 0, 0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Kantumruy Pro", sans-serif;
}

body {
    background-color: var(--light-color);
    color: var(--dark-color);
    line-height: 1.6;
}

/* --- Login Page --- */
.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-form {
    background: #ffffff;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-strong);
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.logo {
    margin-bottom: 1.5rem;
}

.logo img {
    max-width: 80px;
}

.login-form h2 {
    margin-bottom: 1.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

.form-group select {
    background-color: white;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px 12px;
    padding-right: 3rem;
}


/* --- Dashboard Layout --- */
.dashboard-container {
    display: none;
}

.dashboard-header {
    background-color: white;
    padding: 0 2rem;
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-soft);
    position: fixed;
    width: calc(100% - var(--sidebar-width));
    top: 0;
    left: var(--sidebar-width);
    z-index: 100;
    transition: all 0.3s ease;
}

.header-left h1 {
    font-size: 1.75rem;
    font-weight: 600;
}

.user-profile {
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 0.75rem;
    border: 2px solid var(--light-color);
    object-fit: cover;
}

.user-profile span {
    font-weight: 500;
}

.user-profile i {
    margin-left: 0.5rem;
    transition: transform 0.3s;
}

.user-profile .dropdown-menu.active+i {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background-color: white;
    box-shadow: var(--shadow-strong);
    border-radius: var(--border-radius);
    padding: 0.5rem 0;
    display: none;
    min-width: 160px;
    z-index: 101;
    overflow: hidden;
}

.dropdown-menu.active {
    display: block;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: #083a6d;
    color: white;
    padding: 1.5rem 0;
    transition: all 0.3s ease;
    z-index: 200;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    height: var(--header-height);
    margin-bottom: 1rem;
}

.sidebar-logo img {
    height: 65px;
    margin-right: 1rem;
}

.sidebar-logo span {
    font-size: 1.5rem;
    font-weight: 600;
    white-space: nowrap;
}

.sidebar nav {
    flex-grow: 1;
}

.sidebar nav ul {
    list-style: none;
    padding: 0 1rem;
}

.sidebar nav ul li a {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: white;
    text-decoration: none;
    transition: all 0.3s;
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
}

.sidebar nav ul li a i {
    margin-right: 1rem;
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar nav ul li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar nav ul li.active a {
    background-color: var(--primary-color);
}

.sidebar-footer {
    padding: 1rem;
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    position: absolute;
    bottom: 0;
    width: 100%;
}


.main-content {
    margin-left: var(--sidebar-width);
    padding: calc(var(--header-height) + 2rem) 2rem 2rem;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}


/* --- Content Cards & Sections --- */
.welcome-section,
.user-details,
.content-container,
.chart-container,
.filter-container {
    background-color: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-soft);
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.detail-item label {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    display: block;
}

.detail-item span {
    font-weight: 500;
    font-size: 1.05rem;
}

.manage-users-container h3,
.register-user-container h3,
.reset-password-container h3 {
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
    font-weight: 600;
}

.register-user-container, .reset-password-container {
    max-width: 800px;
    margin: 0 auto;
}

.standalone-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.5rem;
    background: #fdfdfd;
    padding: 2rem;
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
}

.standalone-form .btn-submit {
    grid-column: span 2;
    margin-top: 1rem;
}


/* --- Buttons --- */
.btn-login,
.btn-submit {
    width: 100%;
    padding: 0.85rem;
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.3s, background-color 0.3s;
}

.btn-login:hover,
.btn-submit:hover {
    background-color: var(--secondary-color);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.4);
}

.btn-logout {
    width: 100%;
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    text-align: left;
    color: var(--dark-color);
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
    display: flex;
    align-items: center;
    font-size: 1rem;
}

.btn-logout i {
    margin-right: 0.75rem;
}

.btn-logout:hover {
    background-color: var(--danger-color);
    color: white;
}

.actions button {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    border: none;
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    margin: 0 4px;
    transition: all 0.2s ease-in-out;
}

.actions button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.btn-approve { background-color: var(--success-color); }
.btn-approve:hover { background-color: var(--success-hover-color); }

.btn-reject { background-color: var(--danger-color); }
.btn-reject:hover { background-color: var(--danger-hover-color); }

.btn-view { background-color: #5dade2; }
.btn-view:hover { background-color: #2e86c1; }

.btn-export-pdf, .btn-export-excel {
    background-color: var(--primary-color);
    color: white;
    padding: 0.7rem 1.2rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-export-pdf:hover, .btn-export-excel:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.btn-export-excel {
    background-color: var(--success-hover-color);
}
.btn-export-excel:hover {
    background-color: var(--success-color);
}

.btn-reset {
    padding: 0.7rem 1.5rem;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.btn-reset:hover {
    background-color: var(--dark-color);
    transform: translateY(-1px);
}


/* --- Tables --- */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

table th {
    background-color: var(--light-color);
    font-weight: 600;
}

table tbody tr:not(.empty-state):hover {
    background-color: #f5f5f5;
}

.table-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

.status-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
    border: 1px solid transparent;
}

.status-badge.pending {
    background-color: var(--warning-bg-color);
    color: var(--warning-color);
    border-color: var(--warning-color);
}

.status-badge.approved, .status-badge.active {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.status-badge.rejected, .status-badge.inactive {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #7f8c8d;
}


/* --- Filters, Tabs & Pagination --- */
.filter-container {
    padding: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1.25rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
    min-width: 150px;
}

.filter-group input[type="text"],
.filter-group select {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid #ced4da;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    background-color: var(--light-color);
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.filter-group select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px 12px;
    padding-right: 3rem;
}

.filter-group input[type="text"]:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.25);
    background-color: #fff;
}

.table-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.items-per-page-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.items-per-page-selector label {
    font-size: 0.9rem;
    color: var(--dark-color);
    font-weight: 500;
}

.items-per-page-selector select {
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    background-color: #fff;
}

.pagination-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: 2rem;
    gap: 0.5rem;
}

.api-pagination {
    display: flex;
    gap: 5px;
    align-items: center;
}

.api-pagination button {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.api-pagination button:hover:not(:disabled) {
    background: #f0f0f0;
}

.api-pagination button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.api-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    color: #666;
    font-size: 0.9em;
}

.page-numbers {
    display: flex;
    gap: 5px;
}

.sub-nav {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 2rem;
}
.sub-nav-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background-color: transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #6c757d;
    border-bottom: 3px solid transparent;
    transition: color 0.3s, border-color 0.3s;
}
.sub-nav-btn:hover {
    color: var(--primary-color);
}
.sub-nav-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}


/* --- Modals --- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: white;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    box-shadow: var(--shadow-strong);
    transform: scale(0.95);
    animation: scaleUp 0.3s forwards;
    display: flex;
    flex-direction: column;
}

.modal-header,
.modal-body,
.modal-footer {
    padding: 1.5rem 2rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 1.5rem;
}

.close-modal {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #aaa;
}

.modal-body {
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid #eee;
}

.user-detail-modal {
    padding: 1rem 0 0 0;
}

.user-detail-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

.modal-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: var(--shadow-soft);
    margin-bottom: 1rem;
}

.user-detail-header h4 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.user-detail-header p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

.user-detail-modal .detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.user-detail-modal .detail-item label {
    font-weight: 600;
    color: var(--dark-color);
}

.user-detail-modal .detail-item span {
    background-color: transparent;
    padding: 0;
}


/* --- Notifications & Messages --- */
.message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: var(--border-radius);
    display: none;
}

.message.error {
    display: block;
    background-color: #f8d7da;
    color: #721c24;
}

.message.success {
    display: block;
    background-color: #d4edda;
    color: #155724;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    color: white;
    z-index: 2000;
    box-shadow: var(--shadow-strong);
    animation: slideIn 0.5s ease-out forwards;
}

.notification.success { background-color: var(--success-color); }
.notification.info { background-color: var(--primary-color); }
.notification.error { background-color: var(--danger-color); }


/* --- Loaders --- */
/* MODIFIED: New loader styles */
#loader-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#loader-wrapper.show {
  opacity: 1;
  visibility: visible;
}

#logo-img {
  max-width: 150px;
  max-height: 150px;
  animation: spin 2s linear infinite;
  border-radius: 50%;
}


button.loading {
    cursor: not-allowed;
    opacity: 0.7;
    position: relative;
    color: transparent !important;
}

button.loading::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}


/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleUp {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateX(120%); }
    to { transform: translateX(0); }
}

/* MODIFIED: Consolidated spin animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}


@media (max-width: 992px) {
    .sidebar { width: var(--sidebar-collapsed-width); }
    .sidebar-logo span, .sidebar nav ul li a span { display: none; }
    .sidebar-logo { padding: 0; justify-content: center; }
    .sidebar-logo img { margin: 0; }
    .sidebar nav ul li a { justify-content: center; }
    .sidebar nav ul li a i { margin: 0; font-size: 1.4rem; }
    .main-content { margin-left: var(--sidebar-collapsed-width); }
    .dashboard-header { width: calc(100% - var(--sidebar-collapsed-width)); left: var(--sidebar-collapsed-width); }
    .standalone-form { grid-template-columns: 1fr; }
    .standalone-form .btn-submit { grid-column: 1; }
}

@media (max-width: 576px) {
    .modal-body, .details-grid, .user-detail-modal .detail-grid { grid-template-columns: 1fr; }
    .full-width { grid-column: 1; }
    .main-content { padding: calc(var(--header-height) + 1rem) 1rem 1rem; }
    .dashboard-header { padding: 0 1rem; }
    .filter-container { flex-direction: column; align-items: stretch; }
    .modal-header, .modal-body, .modal-footer { padding: 1rem 1.25rem; }
}

/* --- Styling for Date Input Filters --- */
.filter-group input[type="date"] {
    width: 100%;
    padding: 0.65rem 1rem; /* Adjusted padding for date input */
    border: 1px solid #ced4da;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    background-color: var(--light-color);
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    line-height: 1.5; /* Ensures vertical alignment */
}

.filter-group input[type="date"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.25);
    background-color: #fff;
}

/* Style for the calendar icon in Webkit browsers (Chrome, Safari) */
.filter-group input[type="date"]::-webkit-calendar-picker-indicator {
    color: var(--dark-color);
    opacity: 0.7;
    cursor: pointer;
    transition: opacity 0.2s;
}

.filter-group input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}
.section-title {
    grid-column: 1 / -1;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #eee;
}
.section-title:first-child {
    margin-top: 0;
}

.filter-actions {
    display: flex;
    gap: 0.75rem; 
    align-items: flex-end; 
    flex-shrink: 0;
}

.btn-apply {
    padding: 0.7rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.btn-apply:hover {
    background-color: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.actions .btn-delete {
    background-color: #e74c3c;
}