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

:root {
  --primary-color: #10b981;
  --primary-hover: #047857;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --bg-body: #f3f4f6;
  --bg-card: #ffffff;
  --border-color: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Base Card / Panel */
.glass-panel, .glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

/* Auth Page */
.auth-page {
  justify-content: center;
  align-items: center;
}

.auth-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.auth-card {
  padding: 40px 30px;
  box-shadow: var(--shadow-md);
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.auth-header p {
  color: var(--text-muted);
  font-size: 14px;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-main);
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: #f9fafb;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background-color: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
}

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

.btn-primary:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-outline {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: transparent;
  color: var(--text-main);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-outline:hover {
  background: #f3f4f6;
}

/* Dashboard */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 5%;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  box-shadow: var(--shadow-sm);
}

.brand-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--primary-color);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  font-weight: 500;
}

.dashboard-container {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 20px;
}

.dashboard-header {
  margin-bottom: 30px;
}

.dashboard-header h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.dashboard-header p {
  color: var(--text-muted);
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.data-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.data-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.card-head h3 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-main);
}

.badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.success { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.badge.warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge.danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }

.card-body p {
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.card-body .price {
  font-weight: 600;
  color: var(--text-main);
  font-size: 16px;
}

.license-box {
  margin-top: 16px;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.license-label {
  font-size: 12px !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px !important;
  color: var(--text-muted) !important;
  font-weight: 600;
}

.license-box code {
  font-family: monospace;
  font-size: 14px;
  color: var(--primary-color);
  word-break: break-all;
  font-weight: 500;
}

.license-empty {
  margin-top: 16px;
  font-size: 13px !important;
  font-style: italic;
  color: var(--warning) !important;
}

/* Helpers */
.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 16px;
  text-align: center;
  background: rgba(239, 68, 68, 0.1);
  padding: 10px;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

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

/* Skeletons */
.skeleton {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.skeleton-line {
  height: 16px;
  background: #e5e7eb;
  border-radius: 4px;
  animation: pulse 1.5s infinite ease-in-out;
}

.skeleton-line.title {
  height: 24px;
  width: 60%;
}

@keyframes pulse {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

.empty-state {
  grid-column: 1 / -1;
  padding: 60px 20px;
  text-align: center;
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px dashed var(--border-color);
}
.empty-state h3 { font-size: 20px; margin-bottom: 8px; color: var(--text-main); }
.empty-state p { color: var(--text-muted); font-size: 14px; }

/* Dashboard Layout */
.dashboard-layout {
  display: flex;
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-body);
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  z-index: 10;
}

.sidebar-header {
  padding: 0 32px 24px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-item:hover {
  background-color: #f3f4f6;
  color: var(--text-main);
}

.nav-item.active {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--primary-color);
}

.nav-item svg {
  width: 20px;
  height: 20px;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}

.content-wrapper {
  padding: 32px;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.section-pane {
  display: none;
}

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

.section-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 24px;
}

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th, .data-table td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background-color: #f9fafb;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* Action Buttons */
.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
}

/* Flex utilities */
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }

/* Settings Form */
.settings-form {
  max-width: 100%;
}

/* Responsive Media Queries */
@media (max-width: 768px) {
  .dashboard-layout {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    order: 2; /* Pindah ke bawah */
    border-right: none;
    border-top: 1px solid var(--border-color);
    padding: 10px 5px calc(10px + env(safe-area-inset-bottom));
    position: fixed;
    bottom: 0;
    z-index: 50;
    background: var(--bg-card);
    height: auto;
  }
  
  .sidebar-header {
    display: none; /* Sembunyikan logo di mobile sidebar */
  }
  
  .sidebar-nav {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    gap: 0;
  }
  
  .nav-item {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 4px 6px;
    font-size: 10px;
    line-height: 1.3;
    text-align: center;
    border-radius: 8px;
    flex: 1;
  }
  
  .nav-item svg {
    margin-right: 0;
    margin-bottom: 4px;
  }
  
  .main-content {
    order: 1;
  }
  
  .topbar {
    padding: 16px;
  }
  
  .content-wrapper {
    padding: 16px;
    padding-bottom: 120px;
  }
  
  .cards-grid {
    grid-template-columns: 1fr;
  }

  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .auth-card {
    padding: 30px 20px;
  }
}
