/* ========================================================
   RoLink Admin Panel Stylesheet
   RS Roemani Muhammadiyah Semarang
   ======================================================== */

:root {
  --roemani-green: #00a14b;
  --roemani-blue: #21409a;
  --roemani-gradient: linear-gradient(135deg, #00a14b 0%, #21409a 100%);

  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #00a14b;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 4px 16px rgba(15, 23, 42, 0.06), 0 0 0 1px #e2e8f0;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --transition: 0.2s ease-in-out;
}

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

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

/* Navbar */
.admin-nav {
  background: var(--roemani-gradient);
  color: #ffffff;
  box-shadow: 0 4px 18px rgba(33, 64, 154, 0.25);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  width: 100%;
  padding: 0.9rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: #ffffff;
  color: var(--roemani-green);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  box-shadow: var(--shadow-sm);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: block;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: #e2e8f0;
  display: block;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}

.btn-primary {
  background: var(--roemani-gradient);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 161, 75, 0.3);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: #e2e8f0;
}

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

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Main Container - Full Desktop Width 100% */
.admin-main {
  width: 100%;
  margin: 1.5rem 0 3rem 0;
  padding: 0 2rem;
}

.admin-container {
  width: 100%;
}

/* Navigation Tabs */
.admin-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.admin-tab {
  background: none;
  border: none;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.admin-tab:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.admin-tab.active {
  background: var(--roemani-gradient);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 161, 75, 0.25);
}

.tab-pane {
  display: none;
}

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

/* Admin Card - Full Width */
.admin-card {
  width: 100%;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  padding: 2rem;
}

.card-header,
.card-header-flex {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: #dcfce7;
  color: var(--roemani-green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.admin-card h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
}

.admin-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Forms */
.admin-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

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

.form-group label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
}

.form-group input,
.form-group select,
.form-group textarea {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.65rem 0.95rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  background: #ffffff;
  color: var(--text-main);
  transition: var(--transition);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--roemani-green);
  box-shadow: 0 0 0 3px rgba(0, 161, 75, 0.12);
}

.form-help {
  font-size: 0.74rem;
  color: var(--text-dim);
}

.form-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 0.75rem 0;
}

.section-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* Switch Toggle Checkbox */
.form-group-checkbox {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
}

.checkbox-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .slider {
  background-color: var(--roemani-green);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.form-actions {
  margin-top: 0.5rem;
  display: flex;
  justify-content: flex-end;
}

/* Quick Filter Bar in Links Tab */
.filter-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.search-input-box {
  flex: 1;
  min-width: 250px;
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.85rem;
}

.search-input-box i {
  color: var(--text-dim);
  margin-right: 0.65rem;
}

.search-input-box input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.88rem;
}

.select-filter {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.85rem;
  background: #ffffff;
  outline: none;
}

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

.links-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.links-table th {
  background: #f1f5f9;
  color: var(--text-muted);
  font-weight: 700;
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 2px solid var(--border-color);
}

.links-table td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.links-table tr:hover {
  background: #f8fafc;
}

.table-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

/* Icon Palette */
.icon-emerald { background: #d1fae5; color: #047857; }
.icon-blue { background: #dbeafe; color: #1d4ed8; }
.icon-amber { background: #fef3c7; color: #d97706; }
.icon-teal { background: #ccfbf1; color: #0f766e; }
.icon-cyan { background: #cffafe; color: #0e7490; }
.icon-purple { background: #ede9fe; color: #6d28d9; }
.icon-rose { background: #ffe4e6; color: #be123c; }
.icon-indigo { background: #e0e7ff; color: #4338ca; }
.icon-red { background: #fee2e2; color: #b91c1c; }
.icon-red-light { background: #fee2e2; color: #dc2626; }
.icon-wa { background: #dcfce7; color: #15803d; }

.link-info-col {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.link-item-title {
  color: var(--text-main);
  font-size: 0.94rem;
}

.link-item-desc {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.link-item-url {
  color: var(--roemani-blue);
  font-size: 0.74rem;
  text-decoration: none;
  font-family: monospace;
}

.link-item-url:hover {
  text-decoration: underline;
}

/* Category Badges */
.badge-cat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.32rem 0.65rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  vertical-align: middle;
}

.badge-cat-simrs { background: #e0e7ff; color: #3730a3; }
.badge-cat-pasien { background: #dcfce7; color: #166534; }
.badge-cat-internal { background: #fef3c7; color: #92400e; }
.badge-cat-info { background: #f3e8ff; color: #6b21a8; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
  vertical-align: middle;
  letter-spacing: 0.02em;
}

.badge-primary { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.badge-amber { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.badge-blue { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-gray { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }

/* Status Toggle Button */
.btn-status-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}

.btn-status-toggle.active {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}

.btn-status-toggle.inactive {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}

/* Action & Move Buttons */
.reorder-btns,
.action-btns {
  display: flex;
  gap: 0.35rem;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  background: #f1f5f9;
  color: var(--text-main);
  border-color: #cbd5e1;
}

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

.btn-edit:hover {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

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

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  overflow-y: auto;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 88vh;
  margin: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  transform: translateY(15px);
  transition: transform 0.2s ease;
  overflow: hidden;
}

.modal-backdrop.active .modal-card {
  transform: translateY(0);
}

.modal-card form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: #ffffff;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text-main);
  background: #f1f5f9;
}

.modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Custom scrollbar for modal body */
.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: #f8fafc;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-shrink: 0;
  background: #fafbfc;
}

.required {
  color: #e11d48;
}

/* Toast */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.35rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  z-index: 2000;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: 0.25s ease;
}

.toast-notification i {
  color: #34d399;
}

.toast-notification.show {
  opacity: 1;
  transform: translateY(0);
}

.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 0.25rem; }

/* File Upload Dropzone */
.file-upload-group {
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  transition: var(--transition);
}

.file-upload-group:hover,
.file-upload-group:focus-within {
  border-color: var(--roemani-green);
  background: #f0fdf4;
}

.upload-dropzone {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  padding: 0.35rem 0;
}

.upload-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 5;
  width: 100%;
  height: 100%;
}

.upload-ui-content {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  pointer-events: none;
}

.upload-ui-icon {
  font-size: 2rem;
  color: var(--roemani-green);
  flex-shrink: 0;
}

.upload-ui-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
}

.upload-file-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-file-hint {
  font-size: 0.73rem;
  color: var(--text-dim);
}

.upload-browse-btn {
  pointer-events: none;
  font-size: 0.78rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.current-file-badge {
  margin-top: 0.75rem;
  padding: 0.5rem 0.85rem;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  color: #0369a1;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.current-file-badge a {
  color: #0284c7;
  font-weight: 700;
  text-decoration: underline;
  word-break: break-all;
}

.btn-clear-file {
  margin-left: auto;
  background: none;
  border: none;
  color: #64748b;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.3rem;
}

.btn-clear-file:hover {
  color: #ef4444;
}

/* Color Picker & Swatches */
.color-picker-container {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
}

.color-swatches-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.color-swatch-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  padding: 0;
  outline: none;
}

.color-swatch-btn:hover {
  transform: scale(1.22);
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.color-swatch-btn.active {
  transform: scale(1.15);
  box-shadow: 0 0 0 2.5px var(--roemani-green), 0 3px 8px rgba(0,0,0,0.25);
}

.color-custom-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-color);
}

.color-picker-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  transition: var(--transition);
  user-select: none;
}

.color-picker-wrapper:hover {
  border-color: var(--roemani-green);
  background: #f0fdf4;
}

.native-color-picker {
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  border-radius: 4px;
}

.color-hex-box {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.32rem 0.55rem;
  font-family: monospace;
  font-size: 0.82rem;
}

.hex-hash {
  color: var(--text-dim);
  margin-right: 2px;
  font-weight: 700;
}

.hex-text-input {
  border: none !important;
  outline: none !important;
  padding: 0 !important;
  font-family: monospace;
  font-size: 0.85rem;
  font-weight: 700;
  width: 60px;
  color: var(--text-main);
  background: transparent !important;
  box-shadow: none !important;
}

.icon-live-preview-box {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.preview-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
}

#iconLivePreview {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .nav-container {
    padding: 0.85rem 1rem;
  }

  .admin-main {
    padding: 0 0.85rem;
    margin: 1rem 0 2rem 0;
  }

  .admin-card {
    padding: 1.25rem 1rem;
  }
}
