/* Streamlit-like styling to match the desktop psx_watchlist app. */
:root {
  --primary: #ff4b4b; /* Streamlit default primary color */
  --text: #262730;
  --muted: #808495;
  --secondary-bg: #f0f2f6;
  --border: #e6e9ef;
  --green: rgb(35, 134, 54);
  --red: rgb(218, 54, 51);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #ffffff;
  color: var(--text);
  font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 2.5rem 3rem;
}

.app-header h1 {
  font-size: 1.7rem;
  font-weight: 700;
  margin: 0 0 0.3rem;
}

.caption {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.2rem 0;
}

/* Tabs (like Streamlit's st.tabs) */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-top: 1.2rem;
}
.tab {
  background: none;
  border: none;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.active {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--primary);
}
.tab:disabled {
  opacity: 0.45;
  cursor: default;
}
.tab-note {
  margin-top: 0.4rem;
}

.refresh-tab {
  margin-top: 1.2rem;
}
.active-count {
  font-size: 0.95rem;
  margin: 0.5rem 0;
}
.refresh-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.8rem 0;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 0.4rem;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
}
.error {
  color: var(--red);
  font-size: 0.9rem;
  min-height: 1.1rem;
  margin: 0.3rem 0;
}

.subheader {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 1.6rem 0 0.5rem;
}
.para {
  font-size: 0.95rem;
  margin: 0.4rem 0;
}

/* Dataframe (like st.dataframe) */
.dataframe {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 0.4rem 0 1rem;
}
.dataframe th {
  background: var(--secondary-bg);
  text-align: left;
  font-weight: 600;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.dataframe th:hover {
  background: #e6e9ef;
}
.dataframe th .sort-arrow {
  color: var(--primary);
  font-size: 0.8em;
  margin-left: 0.15rem;
}
.dataframe td {
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border);
}
.dataframe tbody tr:nth-child(even) {
  background: #fafbfc;
}

/* Expanders (like st.expander) */
.expander {
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  margin: 1rem 0;
  background: #fff;
  overflow: hidden;
}
.expander summary {
  list-style: none;
  cursor: pointer;
  padding: 0.6rem 0.9rem;
  background: var(--secondary-bg);
  font-weight: 600;
  font-size: 1rem;
  user-select: none;
}
.expander summary::-webkit-details-marker {
  display: none;
}
.expander summary::before {
  content: "▶";
  display: inline-block;
  margin-right: 0.5rem;
  font-size: 0.7rem;
}
.expander[open] summary::before {
  content: "▼";
}
.expander-body {
  padding: 0.7rem 0.9rem;
}

/* Warning box (like st.warning) */
.warning {
  background: #fffaea;
  border: 1px solid #ffe08a;
  color: #8a6d00;
  padding: 0.7rem 0.9rem;
  border-radius: 0.4rem;
  font-size: 0.9rem;
  margin-top: 1rem;
}

.footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
}

.loading {
  text-align: center;
  padding: 2rem 0;
  color: var(--muted);
}
.loading[hidden] {
  display: none;
}
.spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 0.8rem;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
