/* =========== VARIABLES =========== */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #f1f5f9;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;

  --bg: #f8fafc;
  --bg-dark: #0f172a;
  --bg-card: #ffffff;
  --sidebar-bg: #1e293b;

  --text: #1e293b;
  --text-light: #64748b;
  --text-muted: #94a3b8;
  --text-white: #ffffff;

  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-full: 9999px;
}

/* =========== RESET =========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* =========== LOGIN SCREEN =========== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 1rem;
}

.login-container {
  background: var(--bg-card);
  padding: 2.5rem 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-logo {
  margin-bottom: 1.5rem;
}

.logo-icon {
  width: 70px;
  height: 70px;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  font-size: 2rem;
  color: white;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

.login-logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.login-logo p {
  color: var(--text-light);
  font-size: 0.9rem;
}

.login-form {
  margin-bottom: 1.25rem;
}

.input-group {
  position: relative;
  margin-bottom: 0.75rem;
}

.input-group i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
}

.input-group input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 3rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  transition: all 0.3s ease;
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 1.25rem;
  margin-bottom: 0.5rem;
}

.btn-login {
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.btn-login:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.login-footer {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* =========== DASHBOARD LAYOUT =========== */
.dashboard {
  display: flex;
  min-height: 100vh;
}

/* =========== SIDEBAR =========== */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  padding: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: white;
  font-size: 1.1rem;
  font-weight: 700;
}

.sidebar-logo i {
  font-size: 1.25rem;
  color: var(--primary-light);
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.7);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.nav-item.active {
  background: var(--primary);
  color: white;
}

.nav-item i {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 0.75rem 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(239, 68, 68, 0.2);
  border: none;
  border-radius: var(--radius-sm);
  color: #fca5a5;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
}

.btn-logout:hover {
  background: var(--danger);
  color: white;
}

/* =========== MAIN CONTENT =========== */
.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 1.5rem;
  min-height: 100vh;
}

/* =========== SECTIONS =========== */
.section {
  display: none;
}

.section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.section-header p {
  color: var(--text-light);
  font-size: 0.9rem;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* =========== BUTTONS =========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  color: white;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
}

.btn-outline {
  background: var(--bg-card);
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--primary);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-copy {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 0.875rem 1.5rem;
}

.btn-copy:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(16, 185, 129, 0.3);
}

.btn-large {
  padding: 0.875rem 1.5rem;
  font-size: 0.95rem;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.btn-text {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-loader {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* =========== STATS GRID =========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.stat-card.gradient-blue::before {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
}
.stat-card.gradient-red::before {
  background: linear-gradient(90deg, #ef4444, #f87171);
}
.stat-card.gradient-purple::before {
  background: linear-gradient(90deg, #8b5cf6, #a78bfa);
}
.stat-card.gradient-orange::before {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}
.stat-card.gradient-teal::before {
  background: linear-gradient(90deg, #14b8a6, #2dd4bf);
}
.stat-card.gradient-pink::before {
  background: linear-gradient(90deg, #ec4899, #f472b6);
}
.stat-card.gradient-cyan::before {
  background: linear-gradient(90deg, #06b6d4, #22d3ee);
}
.stat-card.gradient-green::before {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.stat-card.large {
  grid-column: span 2;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.gradient-blue .stat-icon {
  background: #dbeafe;
  color: #2563eb;
}
.gradient-red .stat-icon {
  background: #fee2e2;
  color: #dc2626;
}
.gradient-purple .stat-icon {
  background: #ede9fe;
  color: #7c3aed;
}
.gradient-orange .stat-icon {
  background: #ffedd5;
  color: #ea580c;
}
.gradient-teal .stat-icon {
  background: #ccfbf1;
  color: #0d9488;
}
.gradient-pink .stat-icon {
  background: #fce7f3;
  color: #db2777;
}
.gradient-cyan .stat-icon {
  background: #cffafe;
  color: #0891b2;
}
.gradient-green .stat-icon {
  background: #dcfce7;
  color: #16a34a;
}

.stat-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-light);
  font-weight: 500;
}

/* =========== CONTENT CARD =========== */
.content-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

/* =========== FORMS =========== */
.user-form,
.settings-form {
  max-width: 100%;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-group label i {
  color: var(--primary);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  transition: all 0.3s ease;
  width: 100%;
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.inline-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.flex-grow {
  flex: 1;
}

.inline-form input {
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  width: 100%;
}

.inline-form input:focus {
  outline: none;
  border-color: var(--primary);
}

/* =========== RESULT BOX =========== */
.result-container {
  margin-top: 1.5rem;
  border: 2px solid var(--success);
  border-radius: var(--radius);
  overflow: hidden;
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-header {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  color: white;
}

.result-header.update {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.result-icon {
  width: 45px;
  height: 45px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.result-title h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.125rem;
}

.result-title p {
  font-size: 0.85rem;
  opacity: 0.9;
}

.result-body {
  padding: 1.25rem;
  background: #f0fdf4;
}

.result-header.update + .result-body {
  background: #fffbeb;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.result-item {
  background: white;
  padding: 0.875rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.item-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.item-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

.result-footer {
  padding: 1.25rem;
  background: white;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}

/* =========== SEARCH BAR =========== */
.search-bar {
  position: relative;
  margin-bottom: 1.25rem;
  width: 100%;
}

.search-bar i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-bar input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  transition: all 0.3s ease;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* =========== TABLES =========== */
.table-scroll-hint {
  display: none;
  text-align: center;
  padding: 8px 12px;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 10px;
  background: #f1f5f9;
  border-radius: 8px;
}

.table-scroll-hint i {
  margin-right: 6px;
  color: #6366f1;
}

.table-wrapper {
  width: 100%;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.table-scroll {
  width: 100%;
  overflow-x: scroll;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table th {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #f8fafc;
}

.data-table tbody tr {
  transition: background 0.2s ease;
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #94a3b8;
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
  display: block;
}

.empty-state p {
  font-size: 14px;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success {
  background: #dcfce7;
  color: #16a34a;
}

.badge-danger {
  background: #fee2e2;
  color: #dc2626;
}

/* =========== WEBSITES =========== */
.websites-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.websites-count {
  font-size: 0.9rem;
  color: var(--text-light);
}

.websites-count span {
  font-weight: 700;
  color: var(--primary);
}

.websites-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.website-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: all 0.3s ease;
}

.website-card:hover {
  border-color: var(--primary);
  background: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.website-card i {
  font-size: 1.1rem;
  color: var(--primary);
}

.website-card span {
  flex: 1;
  font-weight: 500;
  font-size: 0.9rem;
  word-break: break-all;
}

.website-card .external-icon {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* =========== TOAST =========== */
.toast {
  display: none;
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 280px;
  max-width: 90%;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  border-left: 4px solid #10b981;
  z-index: 999999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.toast.show {
  display: flex;
  opacity: 1;
  visibility: visible;
}

.toast i {
  color: #10b981;
  font-size: 20px;
  flex-shrink: 0;
}

.toast span {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.toast.error {
  border-left-color: #ef4444;
}

.toast.error i {
  color: #ef4444;
}

/* =========== MOBILE NAVIGATION =========== */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--sidebar-bg);
  padding: 8px 4px;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.mobile-nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-family: inherit;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 8px;
  min-width: 50px;
}

.mobile-nav-item i {
  font-size: 20px;
}

.mobile-nav-item.active {
  color: white;
  background: var(--primary);
}

/* =========== RESPONSIVE - TABLET =========== */
@media (min-width: 768px) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }

  .result-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .websites-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .inline-form {
    flex-direction: row;
  }

  .websites-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .websites-header .search-bar {
    max-width: 300px;
    margin-bottom: 0;
  }

  .toast {
    bottom: 30px;
  }

  .table-scroll-hint {
    display: none !important;
  }
}

/* =========== RESPONSIVE - DESKTOP =========== */
@media (min-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .stat-card.large {
    grid-column: span 2;
  }

  .result-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .websites-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .user-form,
  .settings-form {
    max-width: 600px;
  }
}

/* =========== RESPONSIVE - MOBILE =========== */
@media (max-width: 767px) {
  .sidebar {
    display: none;
  }

  .mobile-nav {
    display: block;
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
    padding-bottom: 90px;
  }

  .section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .section-header h1 {
    font-size: 1.25rem;
  }

  .header-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .header-actions .btn {
    justify-content: center;
    padding: 10px 12px;
  }

  .header-actions .btn span {
    display: none;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-card {
    padding: 16px 12px;
  }

  .stat-card.large {
    grid-column: span 2;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .content-card {
    padding: 16px;
  }

  .table-scroll-hint {
    display: block;
  }

  .toast {
    bottom: 100px;
    min-width: 260px;
  }
}

/* =========== RESPONSIVE - SMALL MOBILE =========== */
@media (max-width: 380px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-card.large {
    grid-column: span 1;
  }

  .mobile-nav-item {
    min-width: 44px;
    font-size: 9px;
  }

  .mobile-nav-item i {
    font-size: 18px;
  }
}
