/* Base styles and variables */
:root {
  /* Colors */
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #64748b;
  --danger-color: #dc2626;
  --success-color: #16a34a;
  --warning-color: #ca8a04;
  --background-color: #f8fafc;
  --background-color-darkened: #edf3f8;
  --text-color: #1e293b;
  --border-color: #e2e8f0;
    --border-color-hover: #eaf1fa;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  color: var(--text-color);
  background-color: var(--background-color);
}


/*GENERAL STYLES*/
.mobile_menu {display: none;}

/* Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

.main-content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0; /* Prevents content overflow */
}

.main-content {
  flex: 1;
  padding: 2rem;
  background-color: var(--background-color);
  overflow-x: hidden;
}

.content-container {
  margin: 0;
  width: 100%;
}

.content-header {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: start;
  -ms-flex-pack: start;
  justify-content: flex-start;
  -webkit-box-align: start;
  -ms-flex-align: start;
  align-items: start;
  margin-bottom: 2rem;
  gap: 1rem;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  width: 250px;
  flex-shrink: 0;
  background-color: white;
  border-right: 1px solid var(--border-color);
  padding: 1.5rem 0;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 1.5rem;
}

.sidebar-section-title {
  padding: 0.5rem 1.5rem;
  color: var(--secondary-color);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
    opacity: 0.5;
}

.sidebar-nav a {
  display: block;
  padding: 0.75rem 1.5rem;
  color: var(--text-color);
  text-decoration: none;
  transition: background-color 0.2s;
  min-height: 44px;
}

.sidebar-nav a:hover {
  background-color: var(--background-color);
}

.sidebar-nav a.active {
  background-color: var(--background-color);
  color: var(--primary-color);
  font-weight: 600;
}

.site-logo a {
    display: block;
}

.site-logo img {
    width: 150px;
    margin: 0 auto 20px;
    display: block;
}

/* ---------- HEADER ---------- */
.header {
  background-color: white;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}
.header-title-link {
  padding: 1rem 2rem;
  color: var(--text-color);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 600;
}


/* ---------- PROFILE SECTION ---------- */
/* Profile Section */
.profile-section {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
}

.avatar {
  width: 2.5rem;
  height: 2.5rem;
  min-height: 44px;
  min-width: 44px;
  background-color: var(--primary-color);
  color: white;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.profile-dropdown {
  display: none;
  position: absolute;
  top: calc(100%);
  right: 0;
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  box-shadow: var(--shadow);
  min-width: 200px;
  z-index: 1000;
}

.profile-dropdown.visible {
  display: block;
}

.profile-section:hover .profile-dropdown {
  display: block;
}

.profile-dropdown a,
.profile-dropdown button {
  min-height: 44px;
  display: flex;
  width: 100%;
  padding: 0.75rem 1rem;
  text-align: left;
  border: none;
  background: none;
  color: var(--text-color);
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
}

.profile-dropdown a:hover,
.profile-dropdown button:hover {
  background-color: var(--background-color);
}

.logout-form {
  margin: 0;
  padding: 0;
}

.logout-button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--danger-color);
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-size: 1rem;
}

.logout-button:hover {
  background-color: var(--background-color);
}

/* Form Components */
.form-container {
  margin: 0 auto;
  background-color: white;
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-group input:not([type="checkbox"]),
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  font-size: 1rem;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.table-actions form.d-inline,
.table-actions a.btn {float: left;}
.table-actions .btn {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-block;
    padding: 0.9rem 1.2rem;
    font-size: 1rem;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  border-radius: 0.375rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
    line-height: 1rem;
    margin: 0.2rem;
  background: var(--border-color);
    color: var(--text-color);
float: left;
}

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

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: white;
  color: var(--text-color);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--background-color);
}

.copy-data-container {
    display: inline-block;
    margin-bottom: -8px;
}
.copy-data-container button#copy-student-to-payer {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
}

/* Button icons */
.btn::before {
    font-family: boxicons !important;
    font-weight: normal;
    font-style: normal;
    font-size: 1rem;
    vertical-align: bottom;
    margin-right: 0.2rem;
}
.btn-edit::before {content: "\eac0";}
.btn-deactivate::before {content: "\eb8d"; color: var(--danger-color);}
.btn-activate::before {content: "\ebc1"; color: var(--success-color);}
.btn-view::before {content: "\ec0d";}
.btn-terminate::before {content: "\ebae"; color: var(--danger-color);}

button#copy-student-to-payer::before {content: "\ea85";}

/* Tables */

/* Table Header Styles */
.header-content {
    display: flex;
    flex-direction: column;
    align-items: start;
    justify-content: flex-start;
    gap: 0.25rem;
    cursor: pointer;
}

.header-content.sortable {
    position: relative;
    padding-right: 1.5rem;
}

.header-content:not(.sortable) {
  padding-bottom: 1rem;
}

.header-content.sortable:after {
    content: "↕";
    position: absolute;
    right: 0.5rem;
    opacity: 0.3;
}

.header-content.sortable.sorted-asc:after {
    content: "↑";
    opacity: 1;
}

.header-content.sortable.sorted-desc:after {
    content: "↓";
    opacity: 1;
}

/* Filter Input Styles */
.table th {
    padding: 0;
    background-color: var(--border-color);
    font-weight: 600;
    vertical-align: top;
}

.filter-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0;
    border-left: none;
    border-right: none;
    font-size: 0.875rem;
}

.filter-input:focus {
    outline: none;
    background-color: white;
    border-color: var(--primary-color);
}

/* Remove borders between filter inputs */
.table th:not(:last-child) .filter-input {
    border-right: none;
}

.table-container {
  background-color: white;
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
  overflow-x: auto;
  margin-bottom: 2rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

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

.table th {
  background-color: var(--border-color);
  font-weight: 600;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
}

.badge-success {
  background-color: #dcfce7;
  color: var(--success-color);
}

.badge-danger {
  background-color: #fee2e2;
  color: var(--danger-color);
}

.badge-warning {
  background-color: #fef3c7;
  color: #92400e;
}

/* Alerts */
.alert {
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 0.375rem;
  border: 1px solid transparent;
}

.alert-success {
  background-color: #dcfce7;
  border-color: #86efac;
  color: var(--success-color);
}

.alert-danger {
  background-color: #fee2e2;
  border-color: #fca5a5;
  color: var(--danger-color);
}

/* Authentication Pages */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-box {
  background-color: white;
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 400px;
}

/* Signature Pad Styles */

.existing-signature-container {
    margin-bottom: 2rem;
    padding: 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
}

.existing-signature {
    max-width: 300px;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    background-color: white;
    padding: 1rem;
    margin: 1rem 0;

}
.signature-preview-container {
    background-color: white;
    border: 1px solid var(--border-color);;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.signature-preview {
    position: relative;
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
    overflow: hidden;
}

.signature-image {
    max-width: 300px;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    background-color: white;
    padding: 1rem;
    transition: filter 0.3s ease;
}

.signature-preview.unauthorized .signature-image {
    filter: grayscale(1) opacity(0.7);
}

.signature-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
    z-index: 10;
}

.signature-preview.authorized .signature-overlay {
    opacity: 0;
    visibility: hidden;
}

.lock-icon {
    color: #475569;
    margin-bottom: 0.5rem;
    transform: scale(1);
    transition: transform 0.3s ease;
}

.signature-preview:hover .lock-icon {
    transform: scale(1.1);
}

.unlock-message {
    color: #475569;
    font-size: 0.875rem;
    font-weight: 500;
}

.signature-metadata {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background-color: #f1f5f9;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: #64748b;
}

.signature-authorization {
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.signature-authorization.visible {
    opacity: 1;
    transform: translateY(0);
}

.signature-consent {
    margin: 10px 0;
}

.form-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

/* Success animation */
@keyframes checkmark {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.signature-preview.authorized::after {
    content: "✓";
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #22c55e;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    animation: checkmark 0.3s ease forwards;
}
.signature-date {
    color: var(--secondary-color);
    font-size: 0.875rem;
}

.signature-container {
  margin-bottom: 1.5rem;
}

.signature-pad {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin-bottom: 10px;
  background-color: white;
  width: 100%;
  height: 200px;
}

.signature-actions {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.signature-metadata {
    background-color: #f8fafc;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.signature-id {
    margin-bottom: 0.5rem;
}

.monospace {
    font-family: monospace;
    font-size: 0.875rem;
    background: #e2e8f0;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

/* Form Sections */
.form-section {
  margin: 2rem 0;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
    background: var(--background-color);
    padding: 20px;
}

.form-section:last-child {
  border-bottom: none;
}

/* Lesson Agreement Styles */
.detail-container {
  background: white;
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
  padding: 2rem;
    display: flex;
    flex-direction: column;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.detail-section {
  margin-bottom: 2rem;
}

.detail-section h2 {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-item label {
  font-weight: 600;
  color: var(--secondary-color);
  font-size: 0.875rem;
}

.signature-section {
  margin-top: 1rem;
  padding: 1rem;
  background-color: var(--background-color);
  border-radius: 0.5rem;
}


.signature-image {
  max-width: 300px;
  border: 1px solid var(--border-color);
  border-radius: 0.25rem;
  background-color: white;
  padding: 1rem;
}

.signature-date {
  margin-top: 0.5rem;
  color: var(--secondary-color);
  font-size: 0.875rem;
}

.signature-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.signature-details {
    font-size: 0.875rem;
    color: var(--secondary-color);
}

.signature-details small {
    display: inline-block;
}

.signature-placeholder {
  padding: 1rem;
  border: 1px dashed var(--border-color);
  border-radius: 0.25rem;
  text-align: center;
  color: var(--secondary-color);
}

/* GDPR Section Styles */
.consent-section {
  background-color: var(--background-color);
  padding: 1rem;
  border-radius: 0.5rem;
  margin: 1rem 0;
}

.consent-header {
  margin-bottom: 1rem;
  font-weight: 600;
}

.consent-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
}

/* Lesson Agreement Update Styles */
.update-summary {
  background-color: #fff3cd;
  border: 1px solid #ffeeba;
  color: #856404;
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.readonly-field {
  background-color: var(--background-color);
  padding: 0.5rem;
  border-radius: 0.375rem;
  border: 1px solid var(--border-color);
}

/* Student Form Fields */
.student-form-fields {
  position: relative;
  transition: opacity 0.3s ease;
}

.student-form-fields.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading-spinner {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 4px solid var(--background-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 1;
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Filter Styles */
.filter-container {
  background: white;
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
}

.filter-form {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

.filter-group {
  flex: 1;
}

.filter-input,
.filter-select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
}

/* Status Filter */
.status-filter {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.status-filter a {
  color: var(--text-color);
  text-decoration: none;
  margin-right: 1rem;
  font-weight: 500;
}

.status-filter a:hover {
  color: var(--primary-color);
}

.status-filter a.active {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 0.25rem;
}

/* Pagination */
.pagination {
  margin-top: 1rem;
  padding: 1rem;
  background: white;
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.pagination a {
  color: var(--primary-color);
  text-decoration: none;
  padding: 0.5rem;
}

/* Footer */
.footer {
  background-color: white;
  padding: 1rem 2rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.875rem;
  color: var(--secondary-color);
}



.datepicker-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.calendar-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    width: 20px;
    height: 20px;
    cursor: pointer;
    pointer-events: none;
}

/* Flatpickr custom styles */
.flatpickr-calendar {
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    border-radius: 0.5rem;
}

.flatpickr-day.selected {
    background: #2563eb !important;
    border-color: #2563eb !important;
}

.flatpickr-day:hover {
    background: #e2e8f0;
}

.flatpickr-current-month {
    padding-top: 5px !important;
}

.flatpickr-monthDropdown-months {
    background: transparent !important;
}

/* Custom month/year select styles */
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month .numInputWrapper {
    font-size: 1rem;
    border-radius: 0.375rem;
    padding: 0.25rem;
}

.flatpickr-current-month .flatpickr-monthDropdown-months:hover,
.flatpickr-current-month .numInputWrapper:hover {
    background-color: #f1f5f9;
}

/* Clear button styles */
.flatpickr-clear-button {
    padding: 0.25rem 0.5rem;
    margin: 0.25rem;
    border-radius: 0.375rem;
    background-color: #fee2e2;
    color: #dc2626;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.flatpickr-clear-button:hover {
    background-color: #fecaca;
}

.readonly-field-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.readonly-item {
    background-color: #f8fafc;
    padding: 1.25rem;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
}

.readonly-item.full-width {
    grid-column: 1 / -1;
}

.readonly-item label {
    display: block;
    font-weight: 500;
    color: #64748b;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.readonly-value {
    color: #1e293b;
    font-size: 1rem;
    line-height: 1.5;
}

.alert-info {
    background-color: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0369a1;
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.alert-info a {
    color: #0369a1;
    text-decoration: underline;
    font-weight: 600;
}

.alert-info a:hover {
    text-decoration: none;
}

.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 2rem;
  border-radius: 0.5rem;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

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

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  margin: -0.5rem;
  color: var(--secondary-color);
}

.modal-content {
  margin: 1rem 0;
}

.changes-preview {
  white-space: pre-wrap;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  background-color: #f8fafc;
  padding: 0.5rem;
  border-radius: 0.375rem;
  font-family: monospace;
  font-size: 0.875rem;
  cursor: pointer;
  margin: 0;
}

.changes-preview:hover {
  background-color: #f1f5f9;
}

.changes-full {
  white-space: pre-wrap;
  padding: 1rem;
  background-color: #f8fafc;
  border-radius: 0.375rem;
  font-family: monospace;
  font-size: 0.875rem;
  margin: 0;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: white;
  border-top: 1px solid var(--border-color);
  font-size: 0.875rem;
}

.pagination-info {
  color: var(--secondary-color);
}

.pagination-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.pagination-link {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  color: var(--text-color);
  text-decoration: none;
  transition: all 0.2s;
}

.pagination-link:hover {
  background-color: var(--background-color);
  border-color: var(--primary-color);
}

.pagination-link.current {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.pagination-size {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.page-size-select {
  padding: 0.375rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  background-color: white;
}

/* Form rows */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

/* Ensure fields inside rows are evenly spaced */
.form-row .form-group {
  flex: 1;
  min-width: 250px;
  max-width: 50%;
}

/* Form row exceptions */
.name-row .form-group.middle_name,
.name-row .form-group.payer_middle_name {
  max-width: 150px;
}

/* Form sections */
.form-section {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.form-section:last-child {
  border-bottom: none;
}

.form-section h2 {
  color: var(--primary-color);
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  font-weight: 600;
    display: inline-block;
}

/* Form groups */
.form-group {
  margin-bottom: 1.5rem;
}

/* Labels */
.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Required fields */
.required .required-text {
  font-size: 0.875rem;
  color: var(--secondary-color);
  font-weight: normal;
}


/* Required fields */
.required .form-label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.required .form-label .required-marker {
  color: var(--danger-color);
  font-weight: bold;
}

.required .form-label .required-text {
  font-size: 0.875rem;
  color: var(--secondary-color);
  font-weight: normal;
}

/* Form controls */
.form-control {
  width: 100%;
  padding: 0.625rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  font-size: 1rem;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
  outline: none;
}

/* Help text */
.help-text {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--secondary-color);
}

/* Error states */
.error-message {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--danger-color);
}

.form-control.error {
  border-color: var(--danger-color);
}

/* Form actions */
.form-actions {
  display: flex;
  gap: 1rem;
}

/* Checkbox Styles */
.checkbox-group .form-group {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: reverse;
    -ms-flex-direction: row-reverse;
    flex-direction: row-reverse;
    -webkit-box-pack: start;
    -ms-flex-pack: start;
    justify-content: start;
    gap: 6px;
}
.checkbox-group .form-group label {
    margin-bottom: 0;
}
.checkbox-group input#id_remote_signing {
    width: 0;
    height: 0;
}

/* Toast messages */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast-message {
  display: flex;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 15px;
  border-radius: 5px;
  min-width: 250px;
  max-width: 400px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  opacity: 1;
  transition: opacity 0.5s ease-in-out, transform 0.3s ease-in-out;
  transform: translateY(0);
}

.toast-message.success {background-color: #28a745;}
.toast-message.warning {background-color: #ffc107;}
.toast-message.error {background-color: #dc3545;}
.toast-message.info {background-color: #007bff;}

.toast-message .close-btn {
  margin-left: auto;
  background: transparent;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
}

.toast-message.hide {
  opacity: 0;
  transform: translateY(-20px);
}

.readonly-field {
    background-color: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    color: #64748b !important;
    cursor: not-allowed !important;
}

.readonly-field:focus {
    box-shadow: none !important;
    border-color: #e2e8f0 !important;
}

.form-group.email-field .form-label {
    color: #64748b;
}

.form-group.email-field .required-text {
    display: none;
}

.form-group.email-field .help-text {
    color: #64748b;
    font-style: italic;
}

/* Signature Pad Styles */
.signing-mode-section {
    padding: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 20px;
    background-color: #f8fafc;
}

.signing-options {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.signing-option {
    flex: 1;
    padding: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.signing-option:hover {
    border-color: #93c5fd;
    background-color: #f0f9ff;
}

.signing-option.selected {
    border-color: #2563eb;
    background-color: #eff6ff;
}

.option-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.option-content svg {
    flex-shrink: 0;
    color: #64748b;
}

.option-text {
    flex: 1;
}

.remote-fields {
    display: none;
    padding: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 15px;
    background-color: white;
}

.new-badge {
    display: inline-flex;
    align-items: center;
    background-color: #22c55e;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    margin-left: 0.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.8;
    }
}

/*---------- MOBILE RESPONSIVENESS -----------*/

/* TABLETS AND BELOW */
@media (max-width: 768px) {

    .app-container {
        flex-direction: column;
    }

    /*Mobile menu styles*/
    .mobile_menu {display: block;}
    .mobile_menu .menu-icon {
        font-size: 40px;
        padding-left: 1rem;
        color: var(--primary-color);
    }
    .mobile_menu nav.mobile-nav {
        display: none;
        background: white;
        position: absolute;
        border: 1px solid var(--border-color);
        border-radius: 0.375rem;
        box-shadow: var(--shadow);
        min-width: 200px;
        z-index: 1000;
        top: calc(100%);
    }
    .mobile_menu nav.mobile-nav .nav-section .nav-section-title {
        padding: 0.5rem 1.5rem;
        color: var(--secondary-color);
        font-size: 0.875rem;
        font-weight: 600;
        text-transform: uppercase;
        opacity: 0.5;
    }
    .mobile_menu nav.mobile-nav .nav-section a {
        display: block;
        padding: 0.75rem 1.5rem;
        color: var(--text-color);
        text-decoration: none;
        transition: background-color 0.2s;
        min-height: 44px;
    }
    .mobile_menu nav.mobile-nav .nav-section a:hover {
        background-color: var(--background-color);
    }
    .mobile_menu nav.mobile-nav .nav-section a.active{
        background-color: var(--background-color);
        color: var(--primary-color);
        font-weight: 600;
    }
    .mobile_menu nav.mobile-nav.active {display: block;}

    .main-content {
        padding: 1rem;
    }
    .sidebar {
        display: none;
    }

    /*mobile table styles*/
    .table-container {
        margin: 0 auto;
        border-radius: 0;
        overflow-x: auto;
        max-width: 100%;
    }
    .table-container table.table {
        border-collapse: collapse;
        font-size: 0.8rem;
    }
    .table-container table.table thead {}
    .table-container table.table tbody {}
    .table-container table.table thead tr {}
    .table-container table.table tbody tr {}

    .table-container table.table thead tr th:last-child,
    .table-container table.table tbody tr td:last-child{
        position: sticky;
        right: 0;
    }
    .table-container table.table tbody tr td:last-child {
        background: white;
    }
    .table-container table.table thead tr th:last-child::before,
    .table-container table.table tbody tr td:last-child::before {
        content: "";
        display: block;
        position: absolute;
        top: 0;
        right: -1px;
        bottom: 0;
        left: 0;
        z-index: -1;
        border-left: 1px solid #999;
        box-shadow: -4px 8px 8px rgba(0,0,0,0.2);
    }
    .table-actions .btn {
        display: flex;
    }

    .filter-form {
        flex-direction: column;
    }
    .filter-group {
        width: 100%;
    }
    .form-container {
        padding: 1rem;
    }
    .form-row {
        flex-direction: column;
    }
    .form-actions {
        flex-direction: column;
    }
    .form-actions .btn {
        width: 100%;
    }
    .flatpickr-calendar {
        width: 100% !important;
        max-width: 350px;
    }
    .signing-options {
        flex-direction: column;
    }
    .signing-option {
        width: 100%;
    }
}

/*EXTRA LARGE SCREENS*/
@media (min-width: 1920px) {
    .content-container {
        width: 80%;
    }
}

/* Dashboard Specific Styles */
.dashboard-container {
    padding: 1rem;
    max-width: 1200px;
}

.dashboard-sections {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 2rem;
}

.dashboard-card {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.dashboard-card-header {
    padding: 1.25rem;
    background-color: var(--border-color);
    color: #000;
    font-weight: 600;
}

.dashboard-card-header h2 {
    font-size: 1.25rem;
    margin: 0;
}

.dashboard-card-content {
    padding: 1.5rem;
}

.dashboard-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}

.dashboard-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.dashboard-list li:last-child {
    border-bottom: none;
}

.dashboard-list i {
    color: var(--primary-color);
    font-size: 1.25rem;
    margin-top: 0.125rem;
}

.dashboard-action-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
}

.dashboard-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.admin-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.5rem 1rem;
    background-color: var(--background-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.2s;
    gap: 0.5rem;
}

.admin-tile:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    background-color: var(--background-color-darkened);
}

.admin-tile i {
    font-size: 2rem;
    color: var(--primary-color);
}

.admin-tile span {
    font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dashboard-admin-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-action-links {
        flex-direction: column;
    }

    .dashboard-action-links .btn {
        width: 100%;
    }
}

/* Error Page Styles */
.error-box {
    text-align: center;
    padding: 2.5rem;
    max-width: 500px;
}

.error-icon {
    margin-bottom: 1.5rem;
}

.error-heading {
    color: var(--danger-color);
    margin-bottom: 1.5rem;
}

.error-message-container {
    margin-bottom: 2rem;
}

.error-actions {
    margin-bottom: 1.5rem;
}

.error-support {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.error-support a {
    color: var(--primary-color);
    text-decoration: none;
}

.error-support a:hover {
    text-decoration: underline;
}

/* Settings Page Styles */
.settings-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.settings-form-card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.settings-form-header {
    background-color: var(--background-color-darkened);
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.settings-form-header h2 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.25rem;
    font-weight: 600;
}

.settings-form-body {
    padding: 2rem;
}

.settings-form-body .form-group {
    margin-bottom: 1.5rem;
}

.settings-form-body .form-group:last-child {
    margin-bottom: 0;
}

.settings-form-body .form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.settings-form-body .form-control {
    width: 100%;
    max-width: 300px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.settings-form-body .form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.settings-form-body .form-text {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--secondary-color);
}

.settings-form-body .form-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.btn-save {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-save:active {
    transform: translateY(0);
}

.settings-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.settings-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.info-card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.info-card-header {
    background-color: var(--background-color-darkened);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.info-card-header h3 {
    margin: 0;
    color: var(--text-color);
    font-size: 1rem;
    font-weight: 600;
}

.info-card-body {
    padding: 1.5rem;
}

.last-updated {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.last-updated-icon {
    width: 2rem;
    height: 2rem;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.875rem;
}

.last-updated-text {
    flex: 1;
}

.last-updated-label {
    font-size: 0.75rem;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.last-updated-date {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.875rem;
}

.info-content {
    color: var(--secondary-color);
    font-size: 0.875rem;
    line-height: 1.5;
}

.settings-form-body .alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    border: 1px solid;
}

.settings-form-body .alert-danger {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.settings-form-body .invalid-feedback {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* System Activity Status Styles */
.system-status-card {
    border-left: 4px solid var(--primary-color);
}

.deployment-status {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
    background: var(--background-color);
}

.status-indicator {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.status-safe .status-indicator {
    background-color: #d1fae5;
    color: #059669;
}

.status-caution .status-indicator {
    background-color: #fef3c7;
    color: #d97706;
}

.status-active .status-indicator {
    background-color: #fee2e2;
    color: #dc2626;
}

.status-content {
    flex: 1;
}

.status-message {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.status-safe .status-message {
    color: #059669;
}

.status-caution .status-message {
    color: #d97706;
}

.status-active .status-message {
    color: #dc2626;
}

.last-activity {
    margin-top: 0.75rem;
}

.activity-label {
    font-size: 0.75rem;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.activity-time {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.activity-duration {
    font-size: 0.75rem;
    color: var(--secondary-color);
}

.no-activity {
    color: var(--secondary-color);
    font-style: italic;
    font-size: 0.875rem;
}

/* User Activity Stats */
.user-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: var(--background-color);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.stat-description {
    font-size: 0.75rem;
    color: var(--secondary-color);
}

/* Active Users List */
.active-users-list {
    margin-top: 1rem;
}

.list-header {
    font-size: 0.75rem;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.users-list {
    space-y: 0.5rem;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.user-item:last-child {
    border-bottom: none;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-color);
}

.user-activity-time {
    font-size: 0.75rem;
    color: var(--secondary-color);
}

.more-users {
    text-align: center;
    font-size: 0.75rem;
    color: var(--secondary-color);
    font-style: italic;
    margin-top: 0.5rem;
    padding: 0.5rem;
}

/* Settings Page Responsive */
@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .settings-form-body .form-control {
        max-width: 100%;
    }
    
    .user-stats {
        grid-template-columns: 1fr;
    }
    
    .deployment-status {
        flex-direction: column;
        text-align: center;
    }
    
    .status-indicator {
        align-self: center;
    }
}
