/* ============================================================================
   XIBO CMS CLIENT CSS - HTML Widget Styling
   ============================================================================
   This stylesheet applies to HTML/embedded widgets rendered on displays.
   Use the same design tokens as override.css for visual consistency.
   ============================================================================ */

:root {
  /* Color Tokens (mirrored from override.css) */
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-success: #10b981;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-900: #111827;
  
  --color-background: #ffffff;
  --color-text-primary: #1f2937;
  --color-text-secondary: #6b7280;
  --color-border: #e5e7eb;
  
  /* Typography */
  --font-family-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-weight-normal: 400;
  --font-weight-semibold: 600;
  --line-height-normal: 1.5;
  
  /* Spacing */
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  
  /* Radius & Shadow */
  --radius-md: 0.5rem;
  --shadow-base: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --color-background: #0f172a;
    --color-text-primary: #f1f5f9;
    --color-text-secondary: #cbd5e1;
    --color-border: #475569;
  }
}

/* Global widget styles */
html, body {
  margin: 0;
  padding: 0;
  background-color: var(--color-background);
  color: var(--color-text-primary);
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
}

body {
  padding: var(--space-4);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--color-text-primary);
  margin-top: var(--space-6);
  margin-bottom: var(--space-4);
}

h1 {
  font-size: 2.25rem;
  font-weight: 700;
}

h2 {
  font-size: 1.875rem;
  font-weight: 700;
}

h3 {
  font-size: 1.5rem;
  font-weight: 600;
}

p {
  margin: 0 0 var(--space-4) 0;
  line-height: 1.625;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 150ms ease-in-out;
}

a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

/* Common widget containers */
.widget,
.card,
.panel {
  background-color: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-base);
}

/* Buttons */
button,
.btn {
  background-color: var(--color-primary);
  color: #ffffff;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: all 150ms ease-in-out;
}

button:hover,
.btn:hover {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

button:focus,
.btn:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Forms */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
textarea,
select {
  background-color: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  transition: border-color 150ms ease-in-out;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-6);
}

thead {
  background-color: var(--color-gray-100);
}

th {
  padding: var(--space-4);
  text-align: left;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  border-bottom: 2px solid var(--color-border);
}

td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-primary);
}

tbody tr:hover {
  background-color: var(--color-gray-50);
}

/* Alert boxes */
.alert {
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-6);
  margin-bottom: var(--space-6);
  border-left: 4px solid;
}

.alert-success {
  background-color: #d1fae5;
  border-color: var(--color-success);
  color: #047857;
}

.alert-danger {
  background-color: #fee2e2;
  border-color: var(--color-danger);
  color: #991b1b;
}

.alert-warning {
  background-color: #fef3c7;
  border-color: var(--color-warning);
  color: #92400e;
}

.alert-info {
  background-color: #cffafe;
  border-color: #0ea5e9;
  color: #0c4a6e;
}

/* List styles */
ul, ol {
  margin-bottom: var(--space-6);
  padding-left: var(--space-6);
}

li {
  margin-bottom: var(--space-2);
}

/* Code blocks */
code {
  background-color: var(--color-gray-100);
  color: var(--color-gray-900);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-family: "SF Mono", Monaco, Menlo, Courier, monospace;
  font-size: 0.875rem;
}

pre {
  background-color: var(--color-gray-100);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  overflow-x: auto;
  margin-bottom: var(--space-6);
}

pre code {
  background-color: transparent;
  padding: 0;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}

/* Accessibility */
*:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Table search input sizing moved to CSS for responsive control */
.table-search-input {
  min-width: 11.25rem; /* 180px */
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid var(--color-border);
}

@media (max-width: 600px) {
  .table-search-input {
    min-width: auto;
    width: 100%;
    box-sizing: border-box;
  }
}
