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

:root {
  --raudhah-vibrant-pink: #E91E8C;
  --raudhah-soft-mauve: #C15188;
  --raudhah-pale-pink: #F5ACC2;
  --raudhah-white: #FFFFFF;
  --raudhah-deep-grey: #1E1E2E;
  --raudhah-bg-dark: #0F0F1A;
  --raudhah-bg-card: #1A1A2E;
  --raudhah-text-light: #F0F0F5;
  --raudhah-text-muted: #8A8A9A;
  --font-display: 'PT Serif', Georgia, serif;
  --font-body: 'Poppins', sans-serif;
}

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

body {
  font-family: var(--font-body);
  background: var(--raudhah-bg-dark);
  color: var(--raudhah-text-light);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Hero Section ── */
.hero {
  text-align: center;
  padding: 48px 24px 32px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 300px;
  background: radial-gradient(ellipse, rgba(233,30,140,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--raudhah-white);
  margin-bottom: 6px;
  position: relative;
}

.hero h1 span {
  color: var(--raudhah-vibrant-pink);
}

.hero .tagline {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--raudhah-pale-pink);
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.hero .subtitle {
  font-weight: 300;
  color: var(--raudhah-text-muted);
  font-size: 0.9rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ── Heartbeat Divider ── */
.heartbeat-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 24px auto;
  max-width: 400px;
  gap: 12px;
}

.heartbeat-divider .line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--raudhah-vibrant-pink), transparent);
}

.heartbeat-divider svg {
  width: 80px;
  height: 24px;
  stroke: var(--raudhah-vibrant-pink);
  stroke-width: 2;
  fill: none;
}

/* ── Container ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Month/Year Selector ── */
.month-year-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.month-year-selector label {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--raudhah-text-light);
}

.month-year-selector select {
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid rgba(233,30,140,0.35);
  background: var(--raudhah-bg-card);
  color: var(--raudhah-text-light);
  cursor: pointer;
  transition: border-color 0.2s;
  appearance: auto;
}

.month-year-selector select:hover,
.month-year-selector select:focus {
  border-color: var(--raudhah-vibrant-pink);
  outline: none;
}

/* ── Upload Section ── */
.upload-section {
  margin-bottom: 32px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--raudhah-white);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title .icon {
  color: var(--raudhah-vibrant-pink);
  font-size: 1.1rem;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}

.dropzone {
  background: var(--raudhah-bg-card);
  border: 2px dashed rgba(233,30,140,0.35);
  border-radius: 16px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--raudhah-vibrant-pink);
  box-shadow: 0 0 30px rgba(233,30,140,0.12);
  transform: translateY(-2px);
}

.dropzone.has-file {
  border-color: var(--raudhah-vibrant-pink);
  border-style: solid;
  background: rgba(233,30,140,0.06);
}

.dropzone .branch-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--raudhah-white);
  margin-bottom: 4px;
}

.dropzone .branch-hours {
  font-size: 0.7rem;
  color: var(--raudhah-text-muted);
  margin-bottom: 12px;
}

.dropzone .drop-icon {
  font-size: 1.8rem;
  margin-bottom: 8px;
  color: var(--raudhah-vibrant-pink);
  opacity: 0.7;
  transition: opacity 0.3s;
}

.dropzone:hover .drop-icon {
  opacity: 1;
}

.dropzone .drop-text {
  font-size: 0.75rem;
  color: var(--raudhah-text-muted);
}

.dropzone .file-info {
  display: none;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}

.dropzone.has-file .file-info {
  display: flex;
}

.dropzone.has-file .drop-text {
  display: none;
}

.dropzone.has-file .drop-icon {
  display: none;
}

.file-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.file-badge.xlsx {
  background: rgba(34,197,94,0.15);
  color: #22c55e;
}

.file-badge.pdf {
  background: rgba(239,68,68,0.15);
  color: #ef4444;
}

.file-badge.csv {
  background: rgba(59,130,246,0.15);
  color: #3b82f6;
}

.file-name {
  font-size: 0.72rem;
  color: var(--raudhah-pale-pink);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropzone .remove-file {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(239,68,68,0.2);
  border: none;
  color: #ef4444;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.7rem;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.dropzone .remove-file:hover {
  background: rgba(239,68,68,0.4);
}

.dropzone.has-file .remove-file {
  display: flex;
}

.dropzone input[type="file"] {
  display: none;
}

/* ── Action Buttons ── */
.actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 32px 0;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 14px 36px;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--raudhah-vibrant-pink), var(--raudhah-soft-mauve));
  color: white;
  box-shadow: 0 4px 15px rgba(233,30,140,0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(233,30,140,0.4);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--raudhah-bg-card);
  color: var(--raudhah-pale-pink);
  border: 1px solid rgba(233,30,140,0.3);
}

.btn-secondary:hover {
  background: rgba(233,30,140,0.1);
  border-color: var(--raudhah-vibrant-pink);
}

/* ── Loading Spinner ── */
.spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn.loading .spinner {
  display: block;
}

.btn.loading .btn-text {
  opacity: 0.7;
}

/* ── Error/Alert Panel ── */
.alert {
  padding: 14px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-size: 0.85rem;
  display: none;
  align-items: flex-start;
  gap: 10px;
}

.alert.show {
  display: flex;
}

.alert-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
}

.alert-success {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  color: #86efac;
}

.alert .alert-close {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  margin-left: auto;
  font-size: 1rem;
  opacity: 0.6;
}

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

/* ── Results Section ── */
.results-section {
  display: none;
  margin-bottom: 48px;
}

.results-section.show {
  display: block;
  animation: fadeIn 0.4s ease;
}

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

/* ── Summary Stats ── */
.summary-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--raudhah-bg-card);
  border-radius: 12px;
  padding: 14px 20px;
  flex: 1;
  min-width: 140px;
  border: 1px solid rgba(255,255,255,0.05);
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--raudhah-vibrant-pink);
  font-family: var(--font-display);
}

.stat-card .stat-label {
  font-size: 0.72rem;
  color: var(--raudhah-text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── Branch Filters ── */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-btn {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: 50px;
  border: 1px solid rgba(255,255,255,0.1);
  background: var(--raudhah-bg-card);
  color: var(--raudhah-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  border-color: var(--raudhah-vibrant-pink);
  color: var(--raudhah-pale-pink);
}

.filter-btn.active {
  background: linear-gradient(135deg, var(--raudhah-vibrant-pink), var(--raudhah-soft-mauve));
  color: white;
  border-color: transparent;
}

/* ── Data Table ── */
.table-wrapper {
  background: var(--raudhah-bg-card);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.05);
  max-height: 520px;
  overflow-y: auto;
}

.table-wrapper::-webkit-scrollbar {
  width: 6px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: var(--raudhah-bg-card);
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: var(--raudhah-soft-mauve);
  border-radius: 3px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

thead th {
  background: var(--raudhah-deep-grey);
  color: var(--raudhah-pale-pink);
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 2px solid var(--raudhah-vibrant-pink);
}

tbody tr {
  transition: background 0.15s;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.015);
}

tbody tr:hover {
  background: rgba(233,30,140,0.05);
}

tbody td {
  padding: 10px 16px;
  color: var(--raudhah-text-light);
}

tbody td:first-child {
  font-weight: 500;
  color: var(--raudhah-text-muted);
  font-size: 0.78rem;
}

/* ── Branch Tags ── */
.branch-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
}

.branch-tag.padang-midin {
  background: rgba(99,102,241,0.15);
  color: #a5b4fc;
}

.branch-tag.besut {
  background: rgba(34,197,94,0.15);
  color: #86efac;
}

.branch-tag.manir {
  background: rgba(251,191,36,0.15);
  color: #fcd34d;
}

.branch-tag.seberang-takir {
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
}

.branch-tag.kuala-berang {
  background: rgba(14,165,233,0.15);
  color: #7dd3fc;
}

td.shift-empty {
  color: var(--raudhah-text-muted) !important;
  opacity: 0.5;
}

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 32px 24px;
  color: var(--raudhah-text-muted);
  font-size: 0.72rem;
  border-top: 1px solid rgba(255,255,255,0.04);
  margin-top: 40px;
}

.footer a {
  color: var(--raudhah-vibrant-pink);
  text-decoration: none;
}

/* ── Tab Bar ── */
.tab-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.tab-btn {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 10px 28px;
  border-radius: 50px;
  border: 1px solid rgba(255,255,255,0.1);
  background: var(--raudhah-bg-card);
  color: var(--raudhah-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  border-color: var(--raudhah-vibrant-pink);
  color: var(--raudhah-pale-pink);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--raudhah-vibrant-pink), var(--raudhah-soft-mauve));
  color: white;
  border-color: transparent;
}

/* ── Tab Panels ── */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ── History Section ── */
.history-section {
  margin-bottom: 32px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.history-empty {
  text-align: center;
  color: var(--raudhah-text-muted);
  font-size: 0.85rem;
  padding: 48px 24px;
  background: var(--raudhah-bg-card);
  border-radius: 16px;
  border: 1px dashed rgba(255,255,255,0.08);
}

.history-card {
  background: var(--raudhah-bg-card);
  border-radius: 16px;
  padding: 20px 24px;
  border: 1px solid rgba(255,255,255,0.05);
  transition: border-color 0.2s;
}

.history-card:hover {
  border-color: rgba(233,30,140,0.3);
}

.history-card-active {
  border-color: var(--raudhah-vibrant-pink) !important;
  box-shadow: 0 0 20px rgba(233,30,140,0.1);
}

.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.history-month {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--raudhah-white);
}

.history-date {
  font-size: 0.72rem;
  color: var(--raudhah-text-muted);
}

.history-card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.history-card-stats {
  font-size: 0.78rem;
  color: var(--raudhah-text-muted);
}

.history-incomplete {
  font-size: 0.78rem;
  color: #fbbf24;
  margin-top: 4px;
}

.history-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.btn-sm {
  padding: 8px 20px !important;
  font-size: 0.78rem !important;
}

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.3);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 14px 36px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-danger:hover {
  background: rgba(239,68,68,0.25);
  border-color: #ef4444;
}

/* ── Update Panel ── */
.update-panel {
  display: none;
  background: var(--raudhah-bg-card);
  border-radius: 16px;
  border: 1px solid rgba(233,30,140,0.3);
  padding: 20px 24px;
  margin-bottom: 20px;
  animation: fadeIn 0.3s ease;
}

.update-panel.show {
  display: block;
}

.update-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.update-panel-header h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--raudhah-white);
}

.update-panel-close {
  background: none;
  border: none;
  color: var(--raudhah-text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: color 0.2s;
}

.update-panel-close:hover {
  color: var(--raudhah-vibrant-pink);
}

.update-panel-body {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.update-panel-body select {
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid rgba(233,30,140,0.35);
  background: var(--raudhah-bg-dark);
  color: var(--raudhah-text-light);
  cursor: pointer;
  appearance: auto;
}

.update-dropzone {
  background: var(--raudhah-bg-dark);
  border: 2px dashed rgba(233,30,140,0.35);
  border-radius: 12px;
  padding: 16px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  min-width: 200px;
  flex: 1;
  max-width: 300px;
}

.update-dropzone:hover,
.update-dropzone.dragover {
  border-color: var(--raudhah-vibrant-pink);
}

.update-dropzone.has-file {
  border-color: var(--raudhah-vibrant-pink);
  border-style: solid;
}

.update-dropzone .drop-icon {
  font-size: 1.2rem;
  color: var(--raudhah-vibrant-pink);
  opacity: 0.7;
}

.update-dropzone .drop-text {
  font-size: 0.75rem;
  color: var(--raudhah-text-muted);
}

.update-dropzone .file-info {
  display: none;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.update-dropzone.has-file .file-info { display: flex; }
.update-dropzone.has-file .drop-text { display: none; }
.update-dropzone.has-file .drop-icon { display: none; }

.update-dropzone .remove-file {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(239,68,68,0.2);
  border: none;
  color: #ef4444;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.65rem;
  display: none;
  align-items: center;
  justify-content: center;
}

.update-dropzone.has-file .remove-file { display: flex; }

.update-dropzone input[type="file"] { display: none; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .hero h1 { font-size: 1.6rem; }
  .upload-grid { grid-template-columns: repeat(2, 1fr); }
  .summary-bar { flex-direction: column; }
  .btn { padding: 12px 24px; font-size: 0.82rem; }
}
