/* ================================================================
   AMERICAN RARITIES AI PORTAL - GLOBAL STYLES
   Professional, consistent styling across all pages
   ================================================================ */

/* *** ROOT & TYPOGRAPHY *** */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-feature-settings: 'rlig' 1, 'calt' 1;
  -webkit-font-smoothing: antialiased;
}

/* *** COLOR SCHEME *** */
:root {
  --color-primary: #1e293b;      /* slate-900 */
  --color-secondary: #64748b;    /* slate-500 */
  --color-accent: #E3CC88;       /* gold */
  --color-accent-dark: #c9ad55;  /* gold darker */
  --color-bg: #f8fafc;           /* slate-50 */
  --color-border: #e2e8f0;       /* slate-200 */
  --color-white: #ffffff;
  --color-success: #10b981;      /* emerald-500 */
  --color-warning: #f59e0b;      /* amber-500 */
  --color-error: #ef4444;        /* red-500 */
  --color-info: #3b82f6;         /* blue-500 */
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0f172a;
    --color-secondary: #94a3b8;
  }
}

/* *** FORM ELEMENTS *** */
input:not([type='submit']):not([type='button']):not([type='checkbox']):not([type='radio']),
select,
textarea {
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(227, 204, 136, 0.28);
  border-color: var(--color-accent-dark);
}

input::placeholder,
textarea::placeholder {
  color: #cbd5e1;
}

/* *** BUTTONS *** */
button,
[role='button'],
a.btn {
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: 0.75rem;
  transition: all 0.15s ease;
  padding: 0.625rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

button:not(:disabled):hover,
[role='button']:not(:disabled):hover,
a.btn:hover {
  transform: translateY(-1px);
}

button:not(:disabled):active,
[role='button']:not(:disabled):active,
a.btn:active {
  transform: translateY(1px);
}

button:disabled,
[role='button']:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary Button */
button.btn-primary,
.btn-primary {
  background-color: var(--color-primary);
  color: white;
}

button.btn-primary:hover:not(:disabled),
.btn-primary:hover {
  background-color: #0f172a;
}

/* Secondary Button */
button.btn-secondary,
.btn-secondary {
  background-color: var(--color-white);
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}

button.btn-secondary:hover:not(:disabled),
.btn-secondary:hover {
  background-color: var(--color-bg);
  border-color: var(--color-primary);
}

/* Accent Button */
button.btn-accent,
.btn-accent {
  background-color: var(--color-accent);
  color: #111827;
  font-weight: 700;
}

button.btn-accent:hover:not(:disabled),
.btn-accent:hover {
  background-color: var(--color-accent-dark);
}

/* Success Button */
button.btn-success,
.btn-success {
  background-color: var(--color-success);
  color: white;
}

button.btn-success:hover:not(:disabled),
.btn-success:hover {
  background-color: #059669;
}

/* Danger Button */
button.btn-danger,
.btn-danger {
  background-color: var(--color-error);
  color: white;
}

button.btn-danger:hover:not(:disabled),
.btn-danger:hover {
  background-color: #dc2626;
}

/* *** CARDS & PANELS *** */
.card,
[class*='card'],
.panel,
[class*='panel'] {
  background-color: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.card:hover,
.panel:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* *** LINKS *** */
a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--color-accent-dark);
}

a.text-link {
  color: var(--color-info);
}

a.text-link:hover {
  color: #1d4ed8;
}

/* *** TEXT STYLES *** */
h1, h2, h3, h4, h5, h6 {
  font-weight: 900;
  color: var(--color-primary);
  line-height: 1.2;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

small, .text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

.text-muted {
  color: var(--color-secondary);
}

.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }
.text-info { color: var(--color-info); }

/* *** ALERTS & MESSAGES *** */
.alert {
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.alert-success {
  background-color: #d1fae5;
  border-color: #10b981;
  color: #047857;
}

.alert-warning {
  background-color: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.alert-error,
.alert-danger {
  background-color: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

.alert-info {
  background-color: #dbeafe;
  border-color: #3b82f6;
  color: #1e40af;
}

/* *** BADGES & LABELS *** */
.badge,
[class*='badge'] {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-primary {
  background-color: #ede9fe;
  color: #6b21a8;
}

.badge-success {
  background-color: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background-color: #fef3c7;
  color: #78350f;
}

.badge-error {
  background-color: #fee2e2;
  color: #7f1d1d;
}

/* *** TABLES *** */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead {
  background-color: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

th {
  padding: 1rem;
  text-align: left;
  color: var(--color-secondary);
}

td {
  padding: 1rem;
  border-bottom: 1px solid var(--color-border);
}

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

/* *** LOADING & STATES *** */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-secondary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* *** SELECTION *** */
::selection {
  background-color: #ead9a3;
  color: #111827;
}

::-moz-selection {
  background-color: #ead9a3;
  color: #111827;
}

/* *** SCROLLBAR (Webkit) *** */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background-color: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background-color: var(--color-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-secondary);
}

/* *** UTILITIES *** */
.truncate { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.shadow-sm { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
.shadow-md { box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); }
.shadow-lg { box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1); }

/* *** ACCESSIBILITY *** */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* *** RESPONSIVE *** */
@media (max-width: 768px) {
  h1 { font-size: 1.875rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  
  .card, .panel { padding: 1rem; }
  
  table { font-size: 0.8rem; }
  th, td { padding: 0.75rem; }
}

/* *** PRINT STYLES *** */
@media print {
  body { background-color: white; }
  .no-print { display: none !important; }
  a { text-decoration: underline; }
}
