/* MYnyak Engsel Web UI - Dark Theme */

:root {
  --bg: #0a0a0a;
  --bg-card: #141414;
  --bg-input: #1a1a1a;
  --border: #262626;
  --border-focus: #3b82f6;
  --text: #fafafa;
  --text-dim: #a1a1a1;
  --text-muted: #525252;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #22c55e;
  --warning: #f59e0b;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* --- Layout --- */

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

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

.header-left h1 {
  font-size: 16px;
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

#content {
  padding: 16px;
  padding-bottom: 80px;
}

#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  text-decoration: none;
  color: var(--text-dim);
  font-size: 10px;
  transition: color .2s;
}

.nav-item.active { color: var(--accent); }
.nav-icon { font-size: 20px; }

/* --- Utilities --- */

.hidden { display: none !important; }

.badge {
  background: var(--bg-input);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

/* --- Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background .2s, opacity .2s;
  width: 100%;
  gap: 8px;
}

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

.btn-primary {
  background: var(--accent);
  color: white;
}

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

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

.btn-secondary:hover:not(:disabled) { border-color: var(--text-dim); }

.btn-danger {
  background: var(--danger);
  color: white;
}

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

.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-group {
  display: flex;
  gap: 8px;
}

.btn-group .btn { flex: 1; }

/* --- Cards --- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}

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

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-dim);
}

.card-body { font-size: 14px; }

/* --- Form --- */

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.form-input {
  width: 100%;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color .2s;
}

.form-input:focus { border-color: var(--border-focus); }
.form-input::placeholder { color: var(--text-muted); }

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1a1' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* --- Grid --- */

.grid {
  display: grid;
  gap: 12px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.grid-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: border-color .2s;
}

.grid-item:hover { border-color: var(--accent); }
.grid-item-icon { font-size: 28px; margin-bottom: 8px; }
.grid-item-label { font-size: 12px; font-weight: 500; }

/* --- Profile Card --- */

.profile-card {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.profile-number {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-type {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.profile-stats {
  display: flex;
  gap: 16px;
}

.profile-stat {
  flex: 1;
}

.profile-stat-value {
  font-size: 18px;
  font-weight: 700;
}

.profile-stat-label {
  font-size: 11px;
  color: var(--text-dim);
}

/* --- Quota Bar --- */

.quota-bar {
  background: var(--bg-input);
  border-radius: 4px;
  height: 6px;
  margin-top: 8px;
  overflow: hidden;
}

.quota-bar-fill {
  background: var(--accent);
  height: 100%;
  border-radius: 4px;
  transition: width .3s;
}

/* --- List --- */

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.list-item:last-child { border-bottom: none; }

.list-item-content { flex: 1; min-width: 0; }
.list-item-title { font-size: 14px; font-weight: 500; }
.list-item-subtitle { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.list-item-right { text-align: right; flex-shrink: 0; }

/* --- Tabs --- */

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 4px;
}

.tab {
  flex: 1;
  padding: 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: background .2s;
  border: none;
  background: transparent;
  color: var(--text-dim);
}

.tab.active {
  background: var(--accent);
  color: white;
}

/* --- Loading --- */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-dim);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

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

/* --- Empty State --- */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}

.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-text { font-size: 14px; }

/* --- Toast --- */

#toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: toast-in .3s ease;
  pointer-events: auto;
  max-width: 300px;
  text-align: center;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Modal --- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 400px;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* --- Section --- */

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 12px;
}

/* --- Login Page --- */

.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-logo {
  font-size: 32px;
  margin-bottom: 8px;
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 32px;
}

.login-form {
  width: 100%;
  max-width: 320px;
}

/* --- Responsive --- */

@media (min-width: 768px) {
  #app { max-width: 480px; }
}
