/* public/css/portal.css - Design System SaaS Hosting Profil Usaha PT Cipta Optima Persada */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Outfit:wght@500;600;700;800&display=swap');

:root {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --accent: #f59e0b;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --dark: #0f172a;
  --dark-surface: #1e293b;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-focus: #38bdf8;
  --text: #1e293b;
  --text-muted: #64748b;
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-main);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* Layout SaaS Portal */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 270px;
  background: var(--dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,0.08);
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: #fff;
}
.sidebar-brand h2 {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  font-family: var(--font-display);
}
.sidebar-brand p {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 500;
}

.sidebar-nav {
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.92rem;
  transition: all 0.2s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.05);
}
.nav-item.active {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
}
.nav-icon {
  font-size: 1.15rem;
  width: 22px;
  display: inline-block;
  text-align: center;
}

.sidebar-footer {
  padding: 20px 16px;
  padding: 16px 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.06);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.08);
}
.user-avatar-icon {
  font-size: 1.3rem;
  line-height: 1;
}
.user-info {
  flex-grow: 1;
  min-width: 0;
  overflow: hidden;
}
.user-info h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-info p {
  font-size: 0.72rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-logout,
.btn-logout-sidebar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}
.btn-logout:hover,
.btn-logout-sidebar:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
}

.btn-logout-top {
  background: #fef2f2;
  border: 1.5px solid #f87171;
  color: #dc2626;
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-logout-top:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}

/* Image Upload & Clean Preview Components */
.image-upload-wrapper {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.img-preview-box {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}
.img-preview-box img {
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #cbd5e1;
  background: #ffffff;
}
.img-preview-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.upload-dropzone {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.btn-toggle-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  text-decoration: underline;
}
.btn-toggle-link:hover {
  color: var(--primary-hover);
}
.btn-danger-soft {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #dc2626;
  font-weight: 600;
}
.btn-danger-soft:hover {
  background: #ef4444;
  color: #ffffff;
}
.btn-xs {
  padding: 5px 10px;
  font-size: 0.78rem;
  border-radius: 6px;
}
.manual-url-box {
  margin-top: 4px;
}

/* Main Content Area */
.main-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-width: 0;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-title h1 {
  font-size: 1.4rem;
  font-weight: 800;
  font-family: var(--font-display);
}
.page-title p {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover {
  background: var(--bg);
}
.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover {
  background: #059669;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* Tab Panels */
.content-body {
  padding: 32px;
  max-width: 1300px;
  margin: 0 auto;
  width: 100%;
}
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease-in-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Cards & Grid */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
}
.badge-active { background: var(--success-light); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }
.badge-pending { background: var(--warning-light); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.badge-expired { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }

/* Form Styles */
.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 6px;
  color: var(--text);
}
.form-help {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.form-control {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}
textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

.input-prefix-group {
  display: flex;
  align-items: center;
}
.input-prefix {
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-right: none;
  padding: 11px 14px;
  font-size: 0.92rem;
  color: var(--text-muted);
  font-weight: 600;
  border-top-left-radius: var(--radius-sm);
  border-bottom-left-radius: var(--radius-sm);
}
.input-prefix-group input {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.input-suffix {
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-left: none;
  padding: 11px 14px;
  font-size: 0.92rem;
  color: var(--text-muted);
  font-weight: 600;
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}
.input-prefix-group.has-suffix input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

/* Live Preview Splitter */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}
.preview-pane {
  position: sticky;
  top: 90px;
  background: #0f172a;
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}
.preview-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  margin-bottom: 12px;
  padding: 0 4px;
}
.device-toggle {
  display: flex;
  background: rgba(255,255,255,0.1);
  padding: 3px;
  border-radius: 6px;
}
.device-btn {
  background: none;
  border: none;
  color: #94a3b8;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}
.device-btn.active {
  background: var(--primary);
  color: #fff;
}
.preview-nav-shortcuts {
  display: flex;
  gap: 4px;
  align-items: center;
}
.btn-preview-nav {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-preview-nav:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.preview-iframe-wrapper {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  height: 600px;
  width: 100%;
  margin: 0 auto;
  transition: max-width 0.3s;
}
.preview-iframe-wrapper.mobile {
  max-width: 375px;
  height: 640px;
  border: 8px solid #334155;
  border-radius: 28px;
}
.preview-iframe-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Pricing Cards */
.pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 20px;
}
.pricing-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  transition: all 0.2s;
  position: relative;
}
.pricing-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}
.pricing-card.featured {
  border-color: var(--primary);
  background: linear-gradient(180deg, rgba(2, 132, 199, 0.04) 0%, var(--surface) 100%);
}
.pricing-popular-badge {
  position: absolute;
  top: -12px;
  right: 24px;
  background: var(--primary);
  color: white;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.price-tag {
  font-size: 2.2rem;
  font-weight: 800;
  font-family: var(--font-display);
  color: var(--dark);
  margin: 16px 0 24px;
}
.price-tag span {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
}
.plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 30px;
  flex-grow: 1;
}
.plan-feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}
.plan-feature-item::before {
  content: '✓';
  color: var(--success);
  font-weight: 800;
}

/* DNS Guide Box */
.dns-guide-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin-top: 16px;
}
.dns-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.88rem;
}
.dns-table th, .dns-table td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: left;
}
.dns-table th {
  background: #f1f5f9;
  font-weight: 700;
}
.dns-table code {
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 700;
  color: #0f172a;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.active {
  display: flex;
}
.modal-box {
  background: #fff;
  border-radius: var(--radius-md);
  max-width: 520px;
  width: 100%;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}

/* Responsive */
@media (max-width: 1024px) {
  .editor-layout { grid-template-columns: 1fr; }
  .preview-pane { position: static; margin-top: 24px; }
  .grid-2, .pricing-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .app-layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .content-body { padding: 16px; }
  .topbar { padding: 14px 16px; flex-direction: column; align-items: flex-start; gap: 10px; }
}
