/**
 * DB-Startpage - Base Styles
 * CSS Variables, Reset, and Core Reusable Components
 */

/* ===== CSS Variables ===== */
:root {
  --accent: #4c86ff;
  --accent-hover: #3a74e8;
  --bg-dark: #0a1019;
  --bg-card-dark: rgba(255, 255, 255, .06);
  --bg-card-dark-hover: rgba(255, 255, 255, .09);
  --border-dark: rgba(255, 255, 255, .09);
  --text-dark: rgba(233, 237, 242, .92);
  --text-dark-muted: rgba(233, 237, 242, .55);
  
  --bg-light: #f5f7fa;
  --bg-card-light: rgba(255, 255, 255, .8);
  --bg-card-light-hover: rgba(255, 255, 255, .95);
  --border-light: rgba(0, 0, 0, .08);
  --text-light: rgba(10, 16, 25, .92);
  --text-light-muted: rgba(10, 16, 25, .55);
  
  --transition-fast: .12s ease;
  --transition-normal: .2s ease;
  --border-radius: 8px;
  --border-radius-lg: 12px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .15);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .2);
}

/* ===== Reset & Base ===== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-dark);
  color: var(--text-dark);
  background-attachment: fixed;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ===== Reusable Components ===== */

/* Buttons - Base */
.btn-base {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn-base:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* Cards - Base */
.card-base {
  background: var(--bg-card-dark);
  border: 1px solid var(--border-dark);
  border-radius: var(--border-radius-lg);
  padding: 16px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.card-base:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Inputs - Base */
.input-base {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border-dark);
  border-radius: var(--border-radius);
  color: var(--text-dark);
  font-size: 14px;
  transition: all var(--transition-fast);
}

.input-base:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, .08);
}

.input-base::placeholder {
  color: var(--text-dark-muted);
}

/* Tabs - Base (Unified tab component) */
.tabs-base {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-dark);
  padding-bottom: 0;
}

.tab-base {
  padding: 7px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dark-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.tab-base:hover {
  color: var(--text-dark);
  background: rgba(255, 255, 255, .03);
}

.tab-base.active {
  color: var(--text-dark);
  border-bottom-color: var(--accent);
}

/* Modals - Base */
.modal-base .modal-content {
  background: var(--bg-dark);
  border: 1px solid var(--border-dark);
  border-radius: var(--border-radius-lg);
}

.modal-base .modal-header {
  border-bottom-color: var(--border-dark);
}

.modal-base .modal-footer {
  border-top-color: var(--border-dark);
}

/* Badges - Base */
.badge-base {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}

/* Tables - Base */
.table-base {
  width: 100%;
  border-collapse: collapse;
}

.table-base th {
  font-weight: 600;
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid var(--border-dark);
}

.table-base td {
  padding: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, .04);
}

/* Loading - Base */
.loading-base {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-dark-muted);
}

.loading-base::after {
  content: "";
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-dark);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Empty State - Base */
.empty-base {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-dark-muted);
}

.empty-base-icon {
  font-size: 48px;
  opacity: .3;
  margin-bottom: 16px;
}

.empty-base-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.empty-base-text {
  font-size: 14px;
  max-width: 400px;
}

/* Utility Classes */
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, .02);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, .15);
}

/* ===== Light Theme Overrides ===== */
.theme-day {
  background: var(--bg-light);
  color: var(--text-light);
}

.theme-day .card-base {
  background: var(--bg-card-light);
  border-color: var(--border-light);
}

.theme-day .input-base {
  background: rgba(0, 0, 0, .03);
  border-color: var(--border-light);
  color: var(--text-light);
}

.theme-day .input-base::placeholder {
  color: var(--text-light-muted);
}

.theme-day .tab-base {
  color: var(--text-light-muted);
}

.theme-day .tab-base:hover {
  color: var(--text-light);
  background: rgba(0, 0, 0, .02);
}

.theme-day .tab-base.active {
  color: var(--text-light);
}

.theme-day .modal-base .modal-content {
  background: white;
  border-color: var(--border-light);
}

.theme-day .table-base th {
  border-bottom-color: var(--border-light);
}

.theme-day .table-base td {
  border-bottom-color: rgba(0, 0, 0, .04);
}

.theme-day ::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, .02);
}

.theme-day ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .15);
}

.theme-day ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, .25);
}
