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

/* Custom styles for RUNCrawl */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Animations */
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fade-in 0.3s ease-out;
}

/* Code blocks */
.code-block {
  background: #1e293b;
  border-radius: 0.5rem;
  padding: 1rem;
  overflow-x: auto;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Masked key */
.masked-key {
  font-family: monospace;
  letter-spacing: 0.1em;
}

/* Dashboard sidebar */
.sidebar-active {
  background: #1e293b;
  border-left: 3px solid #4f46e5;
}

/* Modal backdrop */
.modal-backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

/* Table styles */
table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #374151;
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #1f2937;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #1f2937;
}

::-webkit-scrollbar-thumb {
  background: #4b5563;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

/* Button loading state */
.btn-loading {
  opacity: 0.6;
  cursor: not-allowed;
  position: relative;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spinner 0.6s linear infinite;
}

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

/* Plan badge */
.plan-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.plan-free {
  background: #374151;
  color: #9ca3af;
}

.plan-starter {
  background: #3b82f6;
  color: white;
}

.plan-pro {
  background: #8b5cf6;
  color: white;
}

.plan-enterprise {
  background: #f59e0b;
  color: white;
}

/* Responsive */
@media (max-width: 768px) {
  .desktop-only {
    display: none;
  }
}

/* Shared RUNCrawl application theme */
.app-theme {
  --app-paper: #f7f8fa;
  --app-ink: #17212b;
  --app-muted: #5d6b75;
  --app-line: #dce3e7;
  --app-teal: #06675d;
  min-height: 100vh;
  background: var(--app-paper) !important;
  color: var(--app-ink) !important;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.app-theme [class~="bg-gray-950"] {
  background-color: var(--app-paper) !important;
}

.app-theme [class~="bg-gray-900"] {
  background-color: #fff !important;
}

.app-theme [class~="bg-gray-800"] {
  background-color: #f1f4f6 !important;
}

.app-theme [class~="bg-gray-700"] {
  background-color: #e6ecef !important;
}

.app-theme [class~="bg-indigo-600"],
.app-theme [class~="bg-indigo-700"] {
  background-color: var(--app-teal) !important;
}

.app-theme [class~="hover:bg-indigo-700"]:hover,
.app-theme [class~="hover:bg-indigo-600"]:hover {
  background-color: #123d3a !important;
}

.app-theme [class~="bg-indigo-900"] {
  background-color: #eaf7f4 !important;
}

.app-theme [class~="bg-green-600"] {
  background-color: #087e70 !important;
}

.app-theme [class~="hover:bg-green-700"]:hover {
  background-color: #06675d !important;
}

.app-theme [class~="bg-green-900"] {
  background-color: #eaf7f0 !important;
}

.app-theme [class~="bg-red-900"] {
  background-color: #fff0ed !important;
}

.app-theme [class~="bg-yellow-900"] {
  background-color: #fff7e8 !important;
}

.app-theme [class~="text-gray-100"],
.app-theme [class~="text-gray-200"] {
  color: var(--app-ink) !important;
}

.app-theme [class~="text-gray-300"] {
  color: #34444e !important;
}

.app-theme [class~="text-gray-400"] {
  color: var(--app-muted) !important;
}

.app-theme [class~="text-gray-500"] {
  color: #697983 !important;
}

.app-theme [class~="text-indigo-400"],
.app-theme [class~="text-indigo-500"] {
  color: #087e70 !important;
}

.app-theme [class~="text-indigo-200"] {
  color: #123d3a !important;
}

.app-theme [class~="text-green-200"] {
  color: #176b47 !important;
}

.app-theme [class~="text-red-200"] {
  color: #a1342e !important;
}

.app-theme [class~="text-yellow-200"] {
  color: #7c5200 !important;
}

.app-theme [class~="border-gray-800"],
.app-theme [class~="border-gray-700"] {
  border-color: var(--app-line) !important;
}

.app-theme [class~="border-indigo-700"],
.app-theme [class~="border-indigo-600"] {
  border-color: #8dc9bd !important;
}

.app-theme [class~="border-green-700"] {
  border-color: #a8d7bf !important;
}

.app-theme [class~="border-red-700"] {
  border-color: #f0c2bb !important;
}

.app-theme input,
.app-theme select,
.app-theme textarea {
  color: var(--app-ink);
  border-color: #cbd5da !important;
  background-color: #fff !important;
}

.app-theme input::placeholder,
.app-theme textarea::placeholder {
  color: #89969e;
}

.app-theme input:focus,
.app-theme select:focus,
.app-theme textarea:focus {
  border-color: #087e70 !important;
  box-shadow: 0 0 0 3px rgb(8 126 112 / 12%);
}

.app-theme button,
.app-theme a {
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.app-theme div[class~="bg-gray-950"]:has(pre),
.app-theme div[class~="bg-gray-950"]:has(code),
.app-theme .code-block {
  background: #142326 !important;
  border-color: #294345 !important;
  color: #e2e8e9 !important;
}

.app-theme div[class~="bg-gray-950"]:has(pre) [class~="text-gray-300"],
.app-theme div[class~="bg-gray-950"]:has(code) [class~="text-gray-300"] {
  color: #d7e0e2 !important;
}

.app-theme div[class~="bg-gray-950"]:has(pre) [class~="text-gray-500"],
.app-theme div[class~="bg-gray-950"]:has(code) [class~="text-gray-500"] {
  color: #9aabad !important;
}

.app-theme .plan-badge {
  border-radius: 4px;
  letter-spacing: 0;
}

.app-theme .plan-free {
  background: #edf1f2;
  color: #53636c;
}

.app-theme .plan-starter {
  background: #d0eee7;
  color: #075e53;
}

.app-theme .plan-pro {
  background: #ffe3da;
  color: #9a452f;
}

.app-theme .plan-enterprise {
  background: #e7edf7;
  color: #344f78;
}

.app-theme .sidebar-active {
  background: #eaf7f4;
  border-left: 3px solid #087e70;
  color: #123d3a;
  font-weight: 600;
}

.app-theme .modal-backdrop {
  background: rgb(23 33 43 / 48%);
  backdrop-filter: blur(3px);
}

.app-theme table {
  color: var(--app-ink);
}

.app-theme th {
  background-color: #f1f4f6;
  color: #34444e;
  border-bottom-color: var(--app-line);
}

.app-theme td {
  border-bottom-color: #e6ecef;
}

.app-theme [class~="overflow-hidden"]:has(> table) {
  overflow-x: auto !important;
}

.auth-page {
  background: var(--app-paper) !important;
}

.auth-content {
  width: min(100%, 440px);
}

.auth-brand,
.app-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--app-ink);
  font-size: 20px;
  font-weight: 800;
}

.brand-mark {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: #06675d;
  color: white;
  font-size: 14px;
  font-weight: 700;
}

.auth-panel {
  border-radius: 6px !important;
  box-shadow: 0 12px 32px rgb(23 33 43 / 6%);
}

.auth-page .auth-content > .text-center {
  margin-bottom: 28px;
}

.auth-page input,
.auth-page button {
  min-height: 44px;
}

.admin-label {
  margin-left: 4px;
  color: #697983;
  font-size: 13px;
  font-weight: 600;
}

.device-code {
  min-width: 210px;
  border-radius: 6px !important;
}

.device-state-mark {
  display: grid;
  width: 48px;
  height: 48px;
  margin-inline: auto;
  place-items: center;
  border-radius: 50%;
  background: #eaf7f0;
  color: #176b47;
  font-size: 26px;
  font-weight: 700;
}

.device-state-mark.error {
  background: #fff0ed;
  color: #a1342e;
}

.app-theme .dashboard-shell {
  min-height: 100vh;
  height: 100vh;
}

.app-theme .dashboard-sidebar {
  flex: 0 0 248px;
  border-right-color: var(--app-line) !important;
  box-shadow: 2px 0 8px rgb(23 33 43 / 3%);
}

.app-theme .dashboard-sidebar nav button {
  border-radius: 4px;
  color: #53636c;
}

.app-theme .dashboard-sidebar nav button:hover {
  background: #f1f4f6 !important;
}

.app-theme .dashboard-sidebar nav button.sidebar-active:hover {
  background: #eaf7f4 !important;
}

.app-theme .dashboard-topbar {
  min-height: 64px;
  border-bottom-color: var(--app-line) !important;
  box-shadow: 0 2px 8px rgb(23 33 43 / 3%);
}

.app-theme .dashboard-shell .flex-1.overflow-y-auto {
  background: var(--app-paper);
}

.app-theme .admin-header,
.app-theme .admin-tabbar {
  border-color: var(--app-line) !important;
}

.app-theme .admin-tabbar > div {
  overflow-x: auto;
}

.app-theme .admin-tabbar [data-tab] {
  flex: 0 0 auto;
  border-radius: 4px 4px 0 0;
  white-space: nowrap;
}

.app-theme .admin-tabbar [data-tab].bg-indigo-600 {
  color: white !important;
}

.app-theme #adminPanel > .p-6 {
  max-width: 1440px;
  margin-inline: auto;
}

::-webkit-scrollbar-track {
  background: #edf1f2;
}

::-webkit-scrollbar-thumb {
  background: #becacf;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #96a8ae;
}

@media (max-width: 768px) {
  .app-theme .dashboard-shell {
    height: auto;
    min-height: 100vh;
    flex-direction: column;
  }

  .app-theme .dashboard-sidebar {
    width: 100%;
    flex: none;
    border-right: 0;
    border-bottom: 1px solid var(--app-line);
  }

  .app-theme .dashboard-sidebar > .p-6 {
    padding: 12px 16px;
  }

  .app-theme .dashboard-sidebar nav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 8px;
  }

  .app-theme .dashboard-sidebar nav button {
    width: auto;
    flex: 0 0 auto;
    padding: 9px 12px;
    white-space: nowrap;
  }

  .app-theme .dashboard-sidebar > .border-t {
    display: none;
  }

  .app-theme .dashboard-shell > .flex-1 {
    min-height: 0;
    overflow: visible;
  }

  .app-theme .dashboard-topbar {
    padding: 12px 16px;
  }

  .app-theme .dashboard-shell .flex-1.overflow-y-auto {
    overflow: visible;
    padding: 16px;
  }

  .app-theme #adminPanel > .p-6 {
    padding: 16px;
  }
}
