* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root{--primary:#059669}

body {
    font-family: Georgia, serif;
    background-color: #f5f5f5;
    line-height: 1.6;
}

/* Navbar styles */
.btn-nav {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    font-weight: 500;
}
.btn-nav:hover { background:#047857 }

.container {
    max-width: 1500px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 20px;
}

.form-wrapper {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--primary);
}

header h1 {
    color: var(--primary);
    font-size: 25px;
    font-weight: bold;
}

/* Info Section */
.info-section {
    margin-bottom: 30px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 15px;
}

.info-grid .form-group label {
    font-size: 13px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
    font-size: 14px;
}

.form-group input {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Rating Scale */
.rating-scale {
    background: #f0f4f8;
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 30px;
    border-left: 4px solid var(--primary);
}

.rating-scale h3 {
    color: var(--primary);
    margin-bottom: 10px;
    font-size: 16px;
}

.scale-items {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.scale-items span {
    font-size: 14px;
}

.scale-items strong {
    color: #2c5aa0;
    margin-right: 5px;
}

/* Training Table */
.training-table {
    margin-bottom: 30px;
    overflow-x: auto;
}

.training-table h3 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 18px;
}

table {
    width: 100%;
    border-collapse: collapse;
    border: 2px solid var(--primary);
    font-size: 13px;
    table-layout: auto;
}

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

th {
    padding: 12px 8px;
    text-align: center;
    font-weight: bold;
    border: 1px solid #fff;
    font-size: 12px;
}

td {
    padding: 8px;
    border: 1px solid #ddd;
    text-align: center;
}

tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

tbody tr:hover {
    background-color: #e8f0fe;
}

/* Column width constraints ONLY for training assessment tables (exclude read-only modals) */
.training-table:not(.read-only-view) table th:nth-child(2),
.training-table:not(.read-only-view) table th:nth-child(3),
.training-table:not(.read-only-view) table th:nth-child(4),
.training-table:not(.read-only-view) table th:nth-child(5),
.training-table:not(.read-only-view) table th:nth-child(6),
.training-table:not(.read-only-view) table th:nth-child(7),
.training-table:not(.read-only-view) table th:nth-child(8)
{
    width: 70px;
    padding: 8px 4px;
}

.training-table:not(.read-only-view) table td:nth-child(2),
.training-table:not(.read-only-view) table td:nth-child(3),
.training-table:not(.read-only-view) table td:nth-child(4),
.training-table:not(.read-only-view) table td:nth-child(5),
.training-table:not(.read-only-view) table td:nth-child(6),
.training-table:not(.read-only-view) table td:nth-child(7),
.training-table:not(.read-only-view) table td:nth-child(8)
{
    width: 70px;
    padding: 4px;
}

/* First column width for read-only modal view */
.training-table.read-only-view table th:nth-child(1),
.training-table.read-only-view table td:nth-child(1) {
    width: 300px;
    min-width: 250px;
}

/* Narrow columns for all numeric fields in read-only modal (columns 2-15) */
.training-table.read-only-view table th:nth-child(n+2),
.training-table.read-only-view table td:nth-child(n+2) {
    width: 70px;
    padding: 8px 4px;
}

/* Ensure all numeric inputs in read-only modal have narrow width */
.training-table.read-only-view table input[type="number"],
.training-table.read-only-view table input[type="text"]:not(.module-input) {
    max-width: 70px !important;
    min-width: 60px !important;
    padding: 6px 4px !important;
    text-align: center;
    width: auto !important;
}

table input[type="text"],
table input[type="number"] {
    width: 100%;
    padding: 8px 10px;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    text-align: left;
    font-size: 13px;
    font-family: Georgia, serif;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

table input[type="text"]:focus,
table input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

/* Training Module Input Styling */
.module-input {
    background: linear-gradient(135deg, #f0fdf4 0%, #dbeafe 100%);
    border: 1.5px solid var(--primary) !important;
    color: #1f2937;
    font-weight: 500;
    resize: none;
    min-height: 38px;
    overflow: visible;
    font-family: Georgia, serif;
    white-space: pre-wrap;
    word-wrap: break-word;
    padding: 8px 10px !important;
    display: block;
    width: 100% !important;
    box-sizing: border-box !important;
}

.module-input[readonly] {
    background: #f9fbff;
    border: 1px solid #cbd5e1 !important;
    color: #64748b;
}

.module-input:focus {
    background: linear-gradient(135deg, #dcfce7 0%, #bfdbfe 100%) !important;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15) !important;
}

/* Narrow numeric fields */
.pre-total,
.pre-max,
.pre-gaps {
    max-width: 70px !important;
    min-width: 60px !important;
    text-align: center;
}

/* Gap Fields Styling */
.pre-gaps,
.pre-percent {
    background: linear-gradient(135deg, #fdf2f8 0%, #fef08a 100%) !important;
    border: 1.5px solid #f59e0b !important;
    color: #92400e;
    font-weight: 600;
}

.pre-gaps:focus {
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15) !important;
}

.pre-percent {
    font-size: 14px;
    padding: 8px 10px;
    max-width: 70px !important;
    min-width: 60px !important;
    text-align: center;
}

.pre-percent:focus {
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15) !important;
}

table input[readonly] {
    background-color: #f9fbff;
    border-color: #cbd5e1;
    font-weight: bold;
    color: #475569;
    cursor: not-allowed;
    opacity: 0.8;
}

    /* Improvement color indicators */
    .improvements {
        font-weight: bold;
    }
    .improvement-good {
        background: #e6f9ec; /* light green */
        color: #19692c;
        border: 1px solid #b7e3c4;
    }
    .improvement-bad {
        background: #fff0f0; /* light red */
        color: #a92828;
        border: 1px solid #f2b7b7;
    }

    /* Slightly larger numeric display for pre-gaps and improvements */

.add-row-btn {
    margin-top: 15px;
    padding: 10px 20px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

.add-row-btn:hover {
    background-color: #218838;
}

/* Comments Section */
.comments-section {
    margin-bottom: 30px;
}

.comments-section h3 {
    color: #2c5aa0;
    margin-bottom: 10px;
    font-size: 16px;
}

textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: Georgia, serif;
    font-size: 14px;
    resize: vertical;
}

textarea:focus {
    outline: none;
    border-color: #2c5aa0;
}

/* Feedback Section */
.feedback-section {
    margin-bottom: 30px;
}

.feedback-section h3 {
    color: #2c5aa0;
    margin-bottom: 15px;
    font-size: 16px;
}

.feedback-options {
    display: flex;
    gap: 30px;
}

.feedback-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.feedback-options input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Note Section */
.note-section {
    background: #fff9e6;
    padding: 15px 20px;
    border-radius: 4px;
    border-left: 4px solid #ffc107;
    margin-bottom: 30px;
}

.note-section p {
    font-weight: bold;
    margin-bottom: 10px;
    color: #856404;
}

.note-section ul {
    margin-left: 20px;
    color: #856404;
}

.note-section li {
    margin-bottom: 5px;
    font-size: 14px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.btn-primary,
.btn-secondary {
    padding: 15px 40px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.btn-primary:hover {
    background-color: #047857;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Success Message */
.success-message {
    background: white;
    padding: 60px 40px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.success-message h2 {
    color: #28a745;
    font-size: 32px;
    margin-bottom: 20px;
}

.success-message p {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
}

.success-message button {
    padding: 15px 40px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

.success-message button:hover {
    background-color: #047857;
}

/* Loading Spinner */
.loading-spinner {
    background: white;
    padding: 60px 40px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

    .spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-spinner p {
    font-size: 18px;
    color: #666;
}

/* Responsive Design */
@media (max-width: 768px) {
    .form-wrapper {
        padding: 20px;
    }


@media (max-width: 900px) {
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .info-grid {
        grid-template-columns: 1fr;
    }
}
    .form-row {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 22px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }

    table {
        font-size: 11px;
    }

    th, td {
        padding: 6px 4px;
    }
}

.signature-container {
    position: relative;
    margin-bottom: 10px;
}

.signature-container img {
    border: 1px solid #ccc;
    padding: 5px;
    margin-bottom: 5px;
    background-color: #fff;
}

.signature-paste-area {
    width: 90%;
    min-height: 50px;
    border: 2px dashed #ccc;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    background: #f9f9f9;
    transition: all 0.2s ease;
}

.signature-paste-area:hover, .signature-paste-area:focus {
    border-color: var(--primary);
    background: #f0f4f8;
    outline: none;
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .form-wrapper {
        box-shadow: none;
        padding: 20px;
    }

    .action-buttons,
    .add-row-btn {
        display: none;
    }

    table {
        page-break-inside: avoid;
    }
}

/* Centered transient modal overlay for success */
.transient-modal {
    display: none; /* hidden by default */
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.45);
    align-items: center;
    justify-content: center;
}
.transient-modal .modal-box {
    background: white;
    padding: 28px 32px;
    border-radius: 10px;
    max-width: 520px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(2,6,23,0.4);
}
.transient-modal .modal-box h2 { font-size: 22px; color: #28a745; margin-bottom: 8px }
.transient-modal .modal-box p { color: #4b5563 }

.filter-select,
.filter-date {
  padding: 6px 10px;
  border: 1px solid #e6eef8;
  border-radius: 6px;
  font-size: 0.95rem;
  min-width: 140px;
}
.filter-date {
  min-width: 120px;
}



html {
    min-height: 100vh;
    overscroll-behavior: none;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    overscroll-behavior: none;
}



/* Filter Controls Layout */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 16px;
  background: #fff;
  border-radius: 8px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Search box takes available space but has limits */
.controls .search {
  flex: 1 1 280px;
  min-width: 200px;
  max-width: 400px;
}

/* All filter dropdowns and date inputs - consistent sizing */
.controls .filter-select,
.controls .filter-date {
  padding: 10px 12px;
  border: 1px solid #e6eef8;
  border-radius: 6px;
  font-size: 14px;
  min-width: 140px;
  max-width: 180px;
  flex: 0 0 auto;
}

/* Month filter label group */
.controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* Action buttons group - push to end and wrap nicely */
.controls .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-left: 0;
}

/* Pagination stays inline with actions */
#paginationControls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
}

/* Buttons consistent size */
.controls .btn {
  padding: 10px 14px;
  font-size: 14px;
  white-space: nowrap;
}

/* At smaller screens, stack vertically */
@media (max-width: 1200px) {
  .controls .actions {
    width: 100%;
    margin-left: 0;
    margin-top: 8px;
    justify-content: flex-start;
  }
}

@media (max-width: 900px) {
  .controls .search {
    flex: 1 1 100%;
    max-width: none;
  }
  
  .controls .filter-select,
  .controls .filter-date {
    flex: 1 1 calc(50% - 6px);
    max-width: none;
  }
}