/* ============================================
   MySafeIP — Corporate Sharp Design System
   ============================================ */

:root {
  --bg-primary: #0b0d12;
  --bg-secondary: #11131a;
  --bg-card: #141720;
  --border-color: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-primary: #2563eb;
  --accent-secondary: #2563eb;
  --accent-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #3b82f6;
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 4px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.4);
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --sidebar-width: 240px;
  --header-height: 56px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* ============================================
   Layout
   ============================================ */

.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-strong);
  text-decoration: none;
  color: var(--text-primary);
}

.sidebar-brand .brand-icon {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.sidebar-brand img {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.sidebar-brand span {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sidebar-nav {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.sidebar-nav a,
.sidebar-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
  text-align: left;
}

.sidebar-nav a:hover,
.sidebar-nav button:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.sidebar-nav a.active {
  background: rgba(37, 99, 235, 0.10);
  color: var(--accent);
  box-shadow: inset 2px 0 0 var(--accent);
}

.sidebar-nav svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-strong);
}

.lang-switcher {
  display: flex;
  gap: 6px;
}

.lang-switcher a {
  flex: 1;
  text-align: center;
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  transition: all 0.15s;
}

.lang-switcher a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(37, 99, 235, 0.06);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Header */
.top-header {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-header-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.top-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
}

.user-pill .avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  color: white;
}

/* Content Area */
.content-area {
  flex: 1;
  padding: 28px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* Mobile Toggle */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px;
}

/* ============================================
   Cards
   ============================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.card-header h3,
.card-header h4,
.card-header h5 {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.card-body {
  padding: 20px;
}

/* ============================================
   Alerts
   ============================================ */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
  animation: slideIn 0.3s ease;
}

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

.alert-success {
  background: rgba(5, 150, 105, 0.08);
  border-color: rgba(5, 150, 105, 0.20);
  color: #34d399;
}

.alert-danger {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.20);
  color: #f87171;
}

.alert-warning {
  background: rgba(217, 119, 6, 0.08);
  border-color: rgba(217, 119, 6, 0.20);
  color: #fbbf24;
}

.alert-info {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.20);
  color: #60a5fa;
}

/* ============================================
   Forms
   ============================================ */

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

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-control,
.form-select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

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

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-check-input {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
  background: transparent;
  cursor: pointer;
  accent-color: var(--accent);
}

.form-check-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  text-decoration: none;
  line-height: 1.5;
}

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

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

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--text-muted);
}

.btn-danger {
  background: rgba(220, 38, 38, 0.10);
  color: #f87171;
  border: 1px solid rgba(220, 38, 38, 0.25);
}

.btn-danger:hover {
  background: rgba(220, 38, 38, 0.18);
}

.btn-success {
  background: rgba(5, 150, 105, 0.10);
  color: #34d399;
  border: 1px solid rgba(5, 150, 105, 0.25);
}

.btn-success:hover {
  background: rgba(5, 150, 105, 0.18);
}

.btn-warning {
  background: rgba(217, 119, 6, 0.10);
  color: #fbbf24;
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.btn-warning:hover {
  background: rgba(217, 119, 6, 0.18);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 0.9375rem;
}

.btn-block {
  width: 100%;
}

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

/* ============================================
   Tables
   ============================================ */

.table-container {
  overflow-x: auto;
}

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

.table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-strong);
  background: var(--bg-secondary);
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  vertical-align: middle;
}

.table tbody tr {
  transition: background 0.12s;
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

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

/* ============================================
   Badges
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-success {
  background: rgba(5, 150, 105, 0.12);
  color: #34d399;
}

.badge-danger {
  background: rgba(220, 38, 38, 0.12);
  color: #f87171;
}

.badge-warning {
  background: rgba(217, 119, 6, 0.12);
  color: #fbbf24;
}

.badge-secondary {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
}

/* ============================================
   Code / Copy
   ============================================ */

code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.8125rem;
  padding: 2px 6px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  color: var(--accent);
  border: 1px solid var(--border-color);
}

.code-block {
  display: block;
  padding: 16px;
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.5;
}

/* ============================================
   Hero / Dashboard
   ============================================ */

.hero {
  text-align: center;
  padding: 48px 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.hero h1 {
  font-size: 1.875rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.hero p {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Feature Cards */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
}

.feature-card .icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.feature-card img {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  opacity: 0.85;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ============================================
   Auth Pages
   ============================================ */

.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--bg-primary);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
}

.auth-card .logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-card .logo .icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.auth-card .logo img {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
}

.auth-card .logo h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.auth-card .logo p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 4px;
}

.auth-links {
  text-align: center;
  margin-top: 20px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.auth-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.auth-links a:hover {
  text-decoration: underline;
}

/* ============================================
   Info Block (for 2FA, tokens, etc.)
   ============================================ */

.info-block {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.15);
}

.info-block p {
  margin-bottom: 6px;
  font-size: 0.875rem;
}

.info-block code {
  font-size: 0.8125rem;
  word-break: break-all;
}

.success-block {
  background: rgba(5, 150, 105, 0.06);
  border-color: rgba(5, 150, 105, 0.15);
}

/* ============================================
   Grid Utilities
   ============================================ */

.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -10px;
}

.col,
.col-12,
.col-md-6,
.col-md-8,
.col-lg-5,
.col-lg-6 {
  padding: 0 10px;
  width: 100%;
}

.col-md-6 {
  flex: 0 0 50%;
  max-width: 50%;
}

.col-md-8 {
  flex: 0 0 66.666%;
  max-width: 66.666%;
}

.col-lg-5 {
  flex: 0 0 41.666%;
  max-width: 41.666%;
}

.col-lg-6 {
  flex: 0 0 50%;
  max-width: 50%;
}

.justify-content-center {
  justify-content: center;
}

.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 20px; }
.mt-5 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 20px; }
.d-inline { display: inline; }
.d-flex { display: flex; }
.d-grid { display: grid; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--accent); }
.text-secondary { color: var(--text-secondary); }
.font-weight-normal { font-weight: 400; }

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .mobile-toggle {
    display: block;
  }

  .content-area {
    padding: 16px;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .auth-card {
    padding: 28px;
  }

  .col-md-6,
  .col-md-8,
  .col-lg-5,
  .col-lg-6 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .table th,
  .table td {
    padding: 12px 16px;
    font-size: 0.875rem;
  }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

.sidebar-overlay.show {
  display: block;
}

/* ============================================
   Animations
   ============================================ */

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

.card {
  animation: fadeIn 0.25s ease;
}

.alert {
  animation: slideIn 0.3s ease;
}

/* Footer */
.app-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border-strong);
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.app-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.app-footer a:hover {
  color: var(--accent);
}
