/* ==================== DESIGN SYSTEM & VARIABLES ==================== */
:root {
  --primary: #0f172a;
  --primary-light: #1e293b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --teal: #0d9488;
  --teal-hover: #0f766e;
  --emerald: #10b981;
  --rose: #f43f5e;
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f2942 100%);
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 20px 30px -10px rgba(15, 23, 42, 0.25);
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-family);
}

body {
  background: var(--bg-gradient);
  min-height: 100vh;
  color: var(--text-main);
  padding: 2.5rem 1.5rem;
  line-height: 1.5;
}

.app-container {
  max-width: 1400px;
  margin: 0 auto;
}

/* ==================== HEADER ==================== */
.header {
  text-align: center;
  margin-bottom: 2.5rem;
  color: #ffffff;
}

.header-badge {
  display: inline-block;
  background: rgba(37, 99, 235, 0.25);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.3);
  padding: 4px 16px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #ffffff 0%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.header p {
  color: #94a3b8;
  font-size: 1rem;
  font-weight: 500;
}

/* ==================== CARDS & CONTAINERS ==================== */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.card-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.card-header.space-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ==================== GRID SYSTEM ==================== */
.grid-3col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}

.form-panel, .search-panel, .api-panel {
  background: #f8fafc;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
}

.panel-header {
  margin-bottom: 1.2rem;
}

.panel-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
}

/* ==================== FORM CONTROLS ==================== */
.input-group {
  margin-bottom: 1.1rem;
  display: flex;
  flex-direction: column;
}

.input-group label {
  font-size: 0.825rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-group input, 
.input-group select {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  font-size: 0.95rem;
  color: var(--text-main);
  transition: all 0.2s ease;
  outline: none;
}

.input-group input:focus, 
.input-group select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.btn-group {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.8rem;
}

/* ==================== BUTTONS ==================== */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  background: #1e293b;
}

.btn-secondary {
  background: var(--teal);
  color: #ffffff;
}
.btn-secondary:hover {
  background: var(--teal-hover);
}

.btn-accent {
  background: var(--accent);
  color: #ffffff;
}
.btn-accent:hover {
  background: var(--accent-hover);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid #cbd5e1;
  color: #475569;
}
.btn-outline:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: var(--text-main);
}

.btn-danger {
  background: #ffe4e6;
  color: var(--rose);
  border: 1px solid #fecdd3;
}
.btn-danger:hover {
  background: #fecdd3;
}

.btn-small {
  padding: 0.45rem 0.9rem;
  font-size: 0.8rem;
}

.action-buttons {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

/* ==================== LIVE QUOTE BOX ==================== */
.quote-box {
  margin-top: 1.2rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quote-label {
  font-weight: 700;
  font-size: 0.85rem;
  color: #1e40af;
}

.quote-val {
  font-weight: 800;
  font-size: 1.05rem;
  color: #1d4ed8;
}

.feedback-msg {
  margin-top: 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #2563eb;
}

/* ==================== API KEY SECTION ==================== */
.api-key-section {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 1.2rem;
  border: 1px solid #e2e8f0;
}

.api-key-section h4 {
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 0.6rem;
  text-transform: uppercase;
}

.key-input-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

.key-input-group input {
  flex: 1;
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
}

.api-status {
  font-size: 0.775rem;
  font-weight: 600;
  margin-top: 0.6rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  color: #64748b;
  display: inline-block;
}

.api-status.ready {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

/* ==================== TABLE STYLES ==================== */
.stock-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  font-size: 0.925rem;
}

th {
  background: #0f172a;
  color: #f8fafc;
  padding: 1rem;
  font-weight: 700;
  text-align: left;
  font-size: 0.825rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-main);
  font-weight: 500;
}

tr:hover td {
  background-color: #f8fafc;
}

.symbol-badge {
  background: #f1f5f9;
  color: var(--primary);
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-size: 0.85rem;
}

.price-display {
  font-weight: 700;
  color: #059669;
  font-size: 1.025rem;
}

.live-badge {
  background: #dbeafe;
  color: #1e40af;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  margin-left: 8px;
}

.empty-row td {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ==================== TOAST NOTIFICATION ==================== */
.message-bar {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 1000;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(10px);
}

.message-bar.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.spinner-small {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.6s linear infinite;
  margin-right: 6px;
}

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

/* ==================== RESPONSIVE MEDIA QUERIES ==================== */
@media (max-width: 768px) {
  body { padding: 1.25rem 0.85rem; }
  .header h1 { font-size: 1.85rem; }
  .card { padding: 1.25rem; border-radius: var(--radius-md); }
  .grid-3col { grid-template-columns: 1fr; gap: 1.25rem; }
  .card-header.space-between { flex-direction: column; align-items: flex-start; }
  th, td { padding: 0.75rem 0.5rem; font-size: 0.825rem; }
  .key-input-group { flex-direction: column; align-items: stretch; }
}
