/* --- JURNAL MENGAJAR GURU MTs --- */
/* Custom variables for premium green/white/slate theme */
:root {
  --primary: #047857;       /* Emerald 700 */
  --primary-light: #ecfdf5; /* Emerald 50 */
  --primary-hover: #065f46; /* Emerald 800 */
  --secondary: #1e293b;     /* Slate 800 */
  --accent: #d97706;        /* Amber 600 */
  --accent-hover: #b45309;  /* Amber 700 */
  --danger: #e11d48;        /* Rose 600 */
  --danger-hover: #be123c;   /* Rose 700 */
  --bg: #f8fafc;            /* Slate 50 */
  --card-bg: #ffffff;
  --border: #e2e8f0;        /* Slate 200 */
  --text: #334155;          /* Slate 700 */
  --text-dark: #0f172a;     /* Slate 900 */
  --text-light: #64748b;    /* Slate 500 */
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.08);
  --radius: 12px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding-bottom: 40px;
}

/* Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
header {
  background: linear-gradient(135deg, #064e3b, #047857, #0d9488);
  color: #ffffff;
  padding: 24px 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  margin-bottom: 24px;
}

header .container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 20px;
}

@media (min-width: 768px) {
  header .container {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.header-title-block {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-logo {
  font-size: 36px;
  background-color: rgba(255, 255, 255, 0.15);
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-badge {
  background-color: rgba(6, 78, 59, 0.4);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(16, 185, 129, 0.2);
  display: inline-block;
  letter-spacing: 1px;
}

.header-title-block h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-top: 2px;
}

/* Header Actions */
.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
}

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

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

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.25);
}

.btn-accent {
  background-color: var(--accent);
  color: #ffffff;
}

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

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}

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

.btn-outline {
  background-color: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

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

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
}

/* Profile Section */
.profile-card {
  background-color: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

@media (min-width: 768px) {
  .profile-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.profile-info-block {
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile-avatar {
  width: 56px;
  height: 56px;
  background-color: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  border: 1px solid rgba(4, 120, 87, 0.1);
  flex-shrink: 0;
}

.profile-details {
  display: flex;
  flex-direction: column;
}

.profile-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.profile-name-row h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-dark);
}

.profile-nip {
  font-family: monospace;
  font-size: 12px;
  background-color: #f1f5f9;
  color: #475569;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
}

.profile-sub {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin-top: 2px;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  color: var(--text-light);
  margin-top: 6px;
  font-weight: 500;
}

.profile-meta span strong {
  color: var(--text);
}

/* Statistics Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (min-width: 992px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-box {
  background-color: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color 0.2s ease;
}

.stat-box:hover {
  border-color: #a7f3d0;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-light);
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 20px;
  font-weight: 900;
  color: var(--text-dark);
  margin-top: 2px;
}

.stat-unit {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-light);
}

/* Main Layout Grid */
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 992px) {
  .workspace-grid {
    grid-template-columns: 350px 1fr;
  }
}

/* Sidebar Box / Form Section */
.form-section {
  background-color: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  height: fit-content;
}

@media (min-width: 992px) {
  .form-section {
    position: sticky;
    top: 20px;
  }
}

.form-header {
  background-color: var(--primary);
  color: #ffffff;
  padding: 16px 20px;
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.edit-badge {
  background-color: var(--accent);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  animation: pulse 2s infinite;
}

.form-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-light);
  letter-spacing: 0.5px;
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: #f8fafc;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-dark);
  outline: none;
  transition: all 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.15);
}

input[readonly] {
  background-color: #f1f5f9;
  color: var(--text-light);
  cursor: not-allowed;
}

textarea {
  resize: none;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.form-actions .btn {
  flex: 1;
}

.form-actions .btn-reset {
  flex: 0 0 80px;
  background-color: #f1f5f9;
  color: #475569;
}

.form-actions .btn-reset:hover {
  background-color: #e2e8f0;
}

/* Filters Panel */
.filters-panel {
  background-color: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filter-row-top {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 576px) {
  .filter-row-top {
    flex-direction: row;
  }
}

.search-wrapper {
  position: relative;
  flex-grow: 1;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 12px;
  color: var(--text-light);
}

.search-input {
  padding-left: 36px;
}

.filter-select {
  width: 100%;
}

@media (min-width: 576px) {
  .filter-select {
    width: 180px;
  }
}

.filter-row-bottom {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  border-top: 1px solid #f1f5f9;
  padding-top: 12px;
}

@media (min-width: 768px) {
  .filter-row-bottom {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.date-range-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-light);
  font-weight: 600;
  flex-wrap: wrap;
}

.date-range-filter input[type="date"] {
  width: 130px;
  padding: 4px 8px;
  font-size: 12px;
}

/* Results Content Area */
.results-card {
  background-color: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.results-header {
  padding: 16px 20px;
  border-b: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
}

.results-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot-indicator {
  width: 10px;
  height: 10px;
  background-color: var(--primary);
  border-radius: 50%;
}

.sort-label {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 500;
}

/* Table Design */
.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

table.table-bordered {
  border: 1px solid #cbd5e1;
}

table.table-bordered th {
  border: 1px solid #cbd5e1;
}

table.table-bordered td {
  border: 1px solid #cbd5e1;
}

th {
  background-color: #f8fafc;
  padding: 14px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.5px;
}

td {
  padding: 16px;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}

tr:hover td {
  background-color: #fafbfc;
}

.col-no {
  text-align: center;
  width: 50px;
  font-family: monospace;
  color: var(--text-light);
}

.date-col {
  font-weight: 800;
  color: var(--text-dark);
}

.day-sub {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 500;
  display: block;
}

.badge-class {
  background-color: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(4, 120, 87, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 11px;
  display: inline-block;
  margin-top: 4px;
}

.mapel-title {
  font-weight: 700;
  color: var(--text-dark);
  display: block;
}

.materi-text {
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.4;
}

.metode-sub {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
  display: block;
}

.presence-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100px;
}

.p-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-align: center;
  display: block;
  border: 1px solid transparent;
}

.p-hadir {
  background-color: #e0e7ff;
  color: #3730a3;
  border-color: #c7d2fe;
}

.p-absen {
  background-color: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

.p-absen-zero {
  background-color: #f1f5f9;
  color: #94a3b8;
  border-color: #e2e8f0;
}

.teacher-notes {
  font-size: 12px;
  color: var(--text-light);
  font-style: italic;
  max-width: 200px;
  word-wrap: break-word;
}

.action-btns {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.btn-action {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: #ffffff;
  transition: all 0.2s ease;
}

.btn-edit {
  color: var(--accent);
  border-color: #fde68a;
  background-color: #fffbeb;
}

.btn-edit:hover {
  background-color: #fef3c7;
}

.btn-delete {
  color: var(--danger);
  border-color: #fecaca;
  background-color: #fef2f2;
}

.btn-delete:hover {
  background-color: #fee2e2;
}

/* Empty State */
.empty-state {
  padding: 48px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.empty-icon {
  font-size: 48px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state h4 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-dark);
}

.empty-state p {
  font-size: 14px;
  color: var(--text-light);
  max-width: 320px;
  margin: 0 auto;
}

/* Mobile responsive card layouts instead of table columns on small screens */
.mobile-cards-view {
  display: none;
}

@media (max-width: 767px) {
  .table-responsive {
    display: none;
  }
  
  .mobile-cards-view {
    display: flex;
    flex-direction: column;
    divide-y: 1px solid #f1f5f9;
  }
  
  .mobile-card {
    padding: 20px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  
  .m-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
  }
  
  .m-card-row {
    display: flex;
    gap: 8px;
    align-items: center;
  }
  
  .m-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: none; /* Controlled by JS */
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background-color: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  overflow: hidden;
  animation: modalEnter 0.2s ease-out;
}

.modal-header {
  padding: 16px 20px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header-profile {
  background-color: var(--primary);
}

.modal-header-delete {
  background-color: var(--danger);
}

.modal-header h4 {
  font-size: 16px;
  font-weight: 800;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.8;
}

.modal-close:hover {
  opacity: 1;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 16px 20px;
  background-color: #f8fafc;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-footer .btn {
  flex: 1;
}

@media (min-width: 576px) {
  .modal-footer .btn {
    flex: initial;
    min-width: 100px;
  }
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  background-color: #0f172a;
  color: #ffffff;
  padding: 14px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 600;
  display: none; /* Controlled by JS */
  align-items: center;
  gap: 10px;
  border-left: 4px solid var(--primary);
}

.toast-success {
  border-left-color: #10b981;
}

.toast-error {
  border-left-color: #f43f5e;
}

.toast-info {
  border-left-color: #0ea5e9;
}

/* Footer style */
footer {
  background-color: #ffffff;
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: 40px;
  text-align: center;
}

footer p {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

/* Animation utilities */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes modalEnter {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Formal Print CSS */
.print-formal-section {
  display: none;
}

@media print {
  body {
    background-color: #ffffff !important;
    color: #000000 !important;
    font-family: "Times New Roman", Times, serif !important;
    padding: 0;
  }
  
  header, 
  .profile-card, 
  .stats-grid, 
  .form-section, 
  .filters-panel, 
  .results-header,
  .action-btns,
  .btn-action,
  th:last-child,
  td:last-child,
  footer,
  .modal-overlay,
  .toast {
    display: none !important;
  }
  
  .container {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  .results-card {
    border: none !important;
    box-shadow: none !important;
  }
  
  .print-formal-section {
    display: block !important;
  }
  
  .kop-surat {
    text-align: center;
    border-bottom: 3px double #000000;
    padding-bottom: 8px;
    margin-bottom: 16px;
  }
  
  .kop-surat h2 {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 2px;
  }
  
  .kop-surat h1 {
    font-size: 18px;
    font-weight: 900;
    margin-bottom: 4px;
  }
  
  .kop-surat p {
    font-size: 11px;
    font-style: italic;
  }
  
  .print-doc-title {
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    text-decoration: underline;
    text-transform: uppercase;
    margin-bottom: 4px;
  }
  
  .print-doc-subtitle {
    text-align: center;
    font-size: 12px;
    margin-bottom: 20px;
  }
  
  .print-meta-table {
    width: 100%;
    margin-bottom: 20px;
    border: none !important;
  }
  
  .print-meta-table td {
    padding: 2px 4px !important;
    border: none !important;
    font-size: 12px !important;
  }
  
  /* Hard table styles for strict print compliance */
  table.print-table {
    width: 100% !important;
    border-collapse: collapse !important;
    display: table !important;
  }
  
  table.print-table th, 
  table.print-table td {
    border: 1px solid #000000 !important;
    padding: 6px 8px !important;
    font-size: 10px !important;
    color: #000000 !important;
    background: transparent !important;
    vertical-align: top !important;
  }
  
  table.print-table th {
    text-align: center !important;
    font-weight: bold !important;
  }
  
  .print-signatures {
    margin-top: 32px;
    width: 100%;
    display: flex;
    justify-content: space-between;
  }
  
  .sig-box {
    width: 200px;
    text-align: center;
    font-size: 12px;
  }
  
  .sig-space {
    height: 60px;
  }
  
  tr, table, div {
    page-break-inside: avoid;
  }
}
-e 
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
