/* =============================================
   SISTEM JADWAL KHOTIB JUM'AT - style.css
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
  --green-dark:    #1a4731;
  --green-mid:     #1f6b44;
  --green-main:    #2d8f5e;
  --green-light:   #3ab07a;
  --green-soft:    #e8f5ee;
  --green-border:  #b2ddc5;

  --gold:          #d4af37;
  --gold-light:    #f0d980;

  --white:         #ffffff;
  --gray-50:       #f8f9fa;
  --gray-100:      #f1f3f4;
  --gray-200:      #e8eaed;
  --gray-300:      #dadce0;
  --gray-400:      #bdc1c6;
  --gray-500:      #80868b;
  --gray-600:      #5f6368;
  --gray-700:      #3c4043;
  --gray-800:      #202124;

  --blue:          #1a73e8;
  --red:           #d93025;
  --orange:        #e37400;
  --success:       #188038;

  --shadow-sm:     0 1px 3px rgba(0,0,0,0.12);
  --shadow-md:     0 4px 12px rgba(0,0,0,0.15);
  --shadow-lg:     0 8px 24px rgba(0,0,0,0.18);

  --radius-sm:     4px;
  --radius-md:     8px;
  --radius-lg:     12px;

  --header-h:      64px;
  --toolbar-h:     52px;
  --statusbar-h:   26px;

  /* Sheet columns: row-num | no | hijriah | masehi | khotib | masjid | aksi */
  --col-rownum:    44px;
  --col-no:        60px;
  --col-hijriah:   200px;
  --col-masehi:    160px;
  --col-khotib:    220px;
  --col-masjid:    220px;
  --col-aksi:      100px;
}

html, body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  font-size: 13px;
  overflow: hidden;
}

/* ── HEADER ── */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-mid) 60%, var(--green-main) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: var(--shadow-md);
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--gold-light);
  box-shadow: 0 0 12px rgba(212,175,55,0.4);
}

.header-title h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.3px;
}

.header-subtitle {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  display: block;
  margin-top: 1px;
}

.hijri-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-md);
  padding: 6px 14px;
}

.clock-time {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
}

.clock-date {
  font-size: 10px;
  color: rgba(255,255,255,0.75);
  margin-top: 1px;
}

/* ── TOOLBAR ── */
.toolbar {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  height: var(--toolbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-300);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  z-index: 90;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  outline: none;
}

.btn:active { transform: scale(0.97); }

.btn-icon { font-size: 13px; }

.btn-primary   { background: var(--green-main); color: var(--white); }
.btn-primary:hover   { background: var(--green-light); box-shadow: 0 2px 8px rgba(45,143,94,0.4); }

.btn-success   { background: var(--success); color: var(--white); }
.btn-success:hover   { background: #1a9940; box-shadow: 0 2px 8px rgba(24,128,56,0.35); }

.btn-warning   { background: var(--orange); color: var(--white); }
.btn-warning:hover   { background: #f08000; box-shadow: 0 2px 8px rgba(227,116,0,0.35); }

.btn-danger    { background: var(--red); color: var(--white); }
.btn-danger:hover    { background: #c0291f; box-shadow: 0 2px 8px rgba(217,48,37,0.35); }

.btn-secondary { background: var(--gray-200); color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-300); }

.btn-edit      { background: #e8f0fe; color: var(--blue); border: 1px solid #c5d7f8; padding: 4px 10px; font-size: 11px; }
.btn-edit:hover { background: #d2e3fc; }

.btn-del       { background: #fce8e6; color: var(--red); border: 1px solid #f5c6c3; padding: 4px 10px; font-size: 11px; }
.btn-del:hover  { background: #fad2cf; }

/* ── SEARCH ── */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 8px;
  font-size: 12px;
  pointer-events: none;
  color: var(--gray-500);
}

.search-box input {
  padding: 5px 10px 5px 28px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12px;
  width: 220px;
  color: var(--gray-800);
  background: var(--gray-50);
  transition: all 0.15s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--green-main);
  background: var(--white);
  box-shadow: 0 0 0 2px rgba(45,143,94,0.15);
}

.record-count {
  padding: 4px 12px;
  background: var(--green-soft);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--green-dark);
}

/* ── SPREADSHEET ── */
.spreadsheet-wrapper {
  position: fixed;
  top: calc(var(--header-h) + var(--toolbar-h));
  left: 0; right: 0;
  bottom: var(--statusbar-h);
  overflow: auto;
  background: var(--gray-100);
}

.spreadsheet-container {
  min-width: 100%;
  min-height: 100%;
  padding: 12px;
}

.sheet {
  display: grid;
  grid-template-columns:
    var(--col-rownum)
    var(--col-no)
    var(--col-hijriah)
    var(--col-masehi)
    var(--col-khotib)
    var(--col-masjid)
    var(--col-aksi);
  width: max-content;
  min-width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-300);
  background: var(--white);
  font-size: 12.5px;
}

/* Column Headers */
.col-header {
  background: linear-gradient(180deg, #f0f4f8 0%, #e2eaf2 100%);
  border-bottom: 2px solid var(--green-main);
  border-right: 1px solid var(--gray-300);
  padding: 9px 10px;
  font-weight: 600;
  color: var(--green-dark);
  font-size: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap;
  user-select: none;
  cursor: default;
  display: flex;
  align-items: center;
}

.col-header.row-num-header {
  justify-content: center;
  background: linear-gradient(180deg, #e6f0eb 0%, #d4e8dc 100%);
  color: var(--green-dark);
}

.action-header {
  justify-content: center;
  background: linear-gradient(180deg, #f0f4f8 0%, #e2eaf2 100%);
}

/* Row wrapper – must be display:contents so cells slot directly into the parent grid */
.sheet-row {
  display: contents;
}

/* Cells */
.cell {
  padding: 7px 10px;
  border-bottom: 1px solid var(--gray-200);
  border-right: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  min-height: 34px;
  word-break: break-word;
  background: var(--white);
  transition: background 0.1s;
}

.cell-rownum {
  justify-content: center;
  color: var(--gray-500);
  font-size: 11px;
  background: #f9fbf9;
  font-weight: 500;
  border-right: 2px solid var(--green-border);
}

.cell-no {
  justify-content: center;
  font-weight: 600;
  color: var(--green-dark);
  font-size: 13px;
}

.cell-hijriah {
  color: var(--green-dark);
  font-size: 12px;
}

.cell-masehi {
  color: var(--gray-700);
}

.cell-khotib {
  font-weight: 500;
  color: var(--gray-800);
}

.cell-masjid {
  color: var(--gray-700);
  font-style: italic;
}

.cell-action {
  justify-content: center;
  gap: 5px;
  background: var(--gray-50);
  border-right: none;
}

/* Row hover – applied via JS class .row-hover on each cell */
.cell.row-hover { background: #f0faf4; }
.cell-rownum.row-hover { background: #e6f5ec; }
.cell-action.row-hover { background: #e6f5ec; }

/* Row striped – applied via JS class .row-even on each cell */
.cell.row-even { background: var(--gray-50); }
.cell-rownum.row-even { background: #f4faf6; }
.cell.row-even.row-hover { background: #eaf7f0; }

/* Selected row – applied via JS class .row-selected on each cell */
.cell.row-selected {
  background: #e0f4ec !important;
  border-bottom-color: var(--green-border);
}

/* ── EMPTY STATE ── */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-500);
  display: none;
}

.empty-state.visible { display: block; }

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  filter: grayscale(30%);
}

.empty-state p {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 6px;
}

.empty-state small {
  font-size: 12px;
  color: var(--gray-400);
}

/* ── STATUS BAR ── */
.status-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--statusbar-h);
  background: var(--green-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 11px;
  color: rgba(255,255,255,0.8);
  z-index: 100;
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.15s ease;
}

.modal-overlay[style*="display:none"] { display: none !important; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 520px;
  max-width: 96vw;
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.confirm-modal { width: 380px; }

.modal-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--green-dark), var(--green-main));
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.danger-header {
  background: linear-gradient(135deg, #8b1a15, var(--red)) !important;
}

.modal-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--white);
}

.modal-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: var(--white);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: background 0.15s;
}
.modal-close:hover { background: rgba(255,255,255,0.3); }

.modal-body { padding: 20px; }

/* ── FORM ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full-width { grid-column: 1 / -1; }

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  letter-spacing: 0.2px;
}

.required { color: var(--red); }

.form-group input,
.form-group textarea {
  padding: 8px 10px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  color: var(--gray-800);
  background: var(--gray-50);
  transition: all 0.15s;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--green-main);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(45,143,94,0.12);
}

.form-group input:valid { border-color: var(--gray-300); }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 6px;
}

.confirm-icon {
  font-size: 40px;
  text-align: center;
  margin-bottom: 12px;
}

#confirmMessage {
  text-align: center;
  font-size: 14px;
  color: var(--gray-700);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ── TOAST ── */
.toast-container {
  position: fixed;
  bottom: 40px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
}

.toast {
  padding: 10px 18px;
  border-radius: var(--radius-md);
  color: var(--white);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.25s ease;
  max-width: 300px;
}

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.toast-success { background: var(--success); }
.toast-error   { background: var(--red); }
.toast-info    { background: var(--blue); }
.toast-warning { background: var(--orange); }

/* ── SCROLLBAR ── */
.spreadsheet-wrapper::-webkit-scrollbar { width: 8px; height: 8px; }
.spreadsheet-wrapper::-webkit-scrollbar-track { background: var(--gray-200); }
.spreadsheet-wrapper::-webkit-scrollbar-thumb { background: var(--gray-400); border-radius: 4px; }
.spreadsheet-wrapper::-webkit-scrollbar-thumb:hover { background: var(--gray-500); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .toolbar-left { gap: 4px; }
  .btn { padding: 5px 8px; font-size: 11px; }
  .search-box input { width: 150px; }
  :root { --col-hijriah: 160px; --col-khotib: 160px; --col-masjid: 160px; }
}
