/* =============================================================================
   CASHSCOPE — COMPONENT STYLES
   =============================================================================
   Imports tokens then defines shared component styles.
   In a React migration, this file goes away — components own their own styles,
   and tokens.css is imported once at the app root.

   TABLE OF CONTENTS
   1. Base Reset & Typography
   2. Layout
   3. Topbar
   4. Buttons
   5. Forms & Inputs
   6. Cards
   7. Tables
   8. Status & Alert Messages
   9. Utilities
   ============================================================================= */

@import url("./tokens.css");


/* =============================================================================
   1. BASE RESET & TYPOGRAPHY
   ============================================================================= */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { font-family: var(--font-heading); }
h1 { font-size: var(--text-2xl); margin-bottom: var(--space-2); }
h2 { font-size: var(--text-lg);  margin-bottom: var(--space-3); }

a { color: var(--color-text-link); text-decoration: none; }
a:hover { color: var(--color-text-link-hover); text-decoration: underline; }

.subtitle {
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.hidden { display: none !important; }


/* =============================================================================
   2. LAYOUT
   ============================================================================= */

.page {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: var(--space-5);
}


/* =============================================================================
   3. TOPBAR
   ============================================================================= */

.topbar {
  height: var(--topbar-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--topbar-padding-x);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.topbar-left img { height: 30px; }

.topbar-right,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  position: relative;
}

.topbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 5px;
  border-radius: var(--radius-full);
  cursor: pointer;
  color: var(--color-text-muted);
  transition: background var(--duration-normal) var(--ease-default), color var(--duration-normal) var(--ease-default);
}

.topbar-icon-btn:hover {
  background: var(--color-surface-sunken);
  color: var(--color-text);
}

.topbar-icon-btn [data-lucide] {
  width: 20px;
  height: 20px;
  stroke-width: 1.75;
  color: var(--color-brand)
}

.account-menu-btn {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  padding: 3px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--duration-normal) var(--ease-default);
}

.account-menu-btn:hover { background: var(--color-surface-sunken); }

@keyframes avatar-shimmer {
  0%   { background-position: -60px 0; }
  100% { background-position: 60px 0; }
}

.account-avatar {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  background: var(--color-brand-subtle);
  color: var(--color-brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
}

.account-avatar:empty {
  background: linear-gradient(90deg, var(--neutral-200) 25%, var(--neutral-100) 50%, var(--neutral-200) 75%);
  background-size: 120px 100%;
  animation: avatar-shimmer 1.2s infinite linear;
}

.account-email {
  color: var(--color-text);
  font-size: var(--text-sm);
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-caret {
  font-size: var(--text-xs);
  opacity: 0.9;
}


/* =============================================================================
   4. BUTTONS
   ============================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: var(--transition-colors);
  text-decoration: none;
  line-height: var(--leading-tight);
}

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

.btn-primary {
  background: var(--color-brand);
  color: var(--color-text-inverse);
}
.btn-primary:hover:not(:disabled) { background: var(--color-brand-hover); }

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border-input);
}
.btn-secondary:hover:not(:disabled) { background: var(--color-surface-raised); }

.btn-danger {
  background: var(--color-danger);
  color: var(--color-text-inverse);
}
.btn-danger:hover:not(:disabled) { background: var(--color-danger-hover); }

.btn-full { width: 100%; height: 40px; font-size: var(--text-md); }

.link-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--color-text-link);
  cursor: pointer;
  padding: 0;
  transition: var(--transition-colors);
}
.link-btn:hover { color: var(--color-text-link-hover); text-decoration: underline; }


/* =============================================================================
   5. FORMS & INPUTS
   ============================================================================= */

.form-group,
.field {
  margin-bottom: var(--space-4);
}

.form-group label,
.field label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.form-group input,
.form-group select,
.field input,
.field select,
textarea {
  width: 100%;
  border: 1px solid var(--color-border-input);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color var(--duration-normal) var(--ease-default),
              box-shadow var(--duration-normal) var(--ease-default);
}

textarea { min-height: 72px; resize: vertical; }

.form-group input:focus,
.form-group select:focus,
.field input:focus,
.field select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 2px var(--color-brand-focus-ring);
}

.hint {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-top: var(--space-2);
  line-height: var(--leading-normal);
}


/* =============================================================================
   6. CARDS
   ============================================================================= */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}


/* =============================================================================
   7. TABLES
   ============================================================================= */

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

thead th {
  background: var(--color-surface-raised);
  color: var(--color-text-secondary);
  font-weight: var(--weight-normal);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition: background var(--duration-fast) var(--ease-default);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--color-surface-raised); }

tbody td {
  padding: var(--space-2) var(--space-3);
  vertical-align: middle;
  color: var(--color-text);
}


/* =============================================================================
   8. STATUS & ALERT MESSAGES
   ============================================================================= */

.msg,
.status {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
  display: none;
}

.msg.show,
.status.show { display: block; }

.msg.success,
.status.success {
  background: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  color: var(--color-success-text);
}

.msg.error,
.status.error {
  background: var(--color-error-bg);
  border: 1px solid var(--color-error-border);
  color: var(--color-error-text);
}


/* =============================================================================
   9. UTILITIES
   ============================================================================= */

.text-center { text-align: center; }
.text-muted   { color: var(--color-text-muted); }
.text-sm      { font-size: var(--text-sm); }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
