/* ───── TOKENS ───── */
:root {
  --accent:        #e8a020;
  --accent-dim:    rgba(232,160,32,0.10);
  --accent-border: rgba(232,160,32,0.32);

  --bg:            #0e0c09;
  --surface:       #151310;
  --surface-2:     #1d1a15;
  --surface-3:     #262219;
  --border:        rgba(255,235,180,0.08);
  --border-mid:    rgba(255,235,180,0.12);

  --text:          #ede5d4;
  --text-muted:    #7a6e5c;
  --text-faint:    #3a342a;

  --danger:        #cc4444;
  --danger-dim:    rgba(204,68,68,0.12);
  --success:       #4a9e6a;
  --warning:       #b87d10;

  --radius-sm:     4px;
  --radius:        8px;
  --radius-lg:     12px;

  --shadow:        0 8px 32px rgba(0,0,0,0.6);
  --t:             0.13s ease;
}

/* ───── RESET ───── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* subtle noise texture overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(232,160,32,0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(232,160,32,0.025) 0%, transparent 50%);
  z-index: 0;
}

#auth-screen, #app-screen { position: relative; z-index: 1; }

/* ───── SCROLLBAR ───── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 2px; }

/* ───── AUTH SCREEN ───── */
#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 36px 30px 28px;
  animation: authIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin-bottom: 6px;
}
.auth-logo strong { color: var(--accent); }

.auth-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 28px;
}

.auth-error {
  background: var(--danger-dim);
  border: 1px solid rgba(204,68,68,0.22);
  border-radius: var(--radius-sm);
  color: #d07070;
  font-size: 13px;
  padding: 10px 12px;
  margin-bottom: 16px;
}

/* ───── FORM ───── */
.form-group { margin-bottom: 12px; }

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--t);
  outline: none;
}
.form-group input:focus { border-color: var(--accent-border); }
.form-group input::placeholder { color: var(--text-faint); }

/* ───── BUTTONS ───── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--t), color var(--t), transform 0.1s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.96); }

.btn-primary { background: var(--accent); color: #0e0c09; border-color: var(--accent); }
.btn-primary:hover { background: #d49218; }

.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-google { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-google:hover { background: var(--surface-3); }

.btn-icon {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
  padding: 6px;
  border-radius: var(--radius-sm);
}
.btn-icon:hover { background: var(--surface-2); color: var(--text); }

.btn-full { width: 100%; margin-top: 6px; }

/* ───── DIVIDER ───── */
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  color: var(--text-faint);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ───── HEADER ───── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 52px;
  background: rgba(14,12,9,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.2px;
}
.header-logo strong { color: var(--accent); }

.header-user { display: flex; align-items: center; gap: 10px; }

.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--border);
}

.user-avatar-placeholder {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 480px) { .user-name { display: none; } }

/* ───── MAIN ───── */
.main {
  max-width: 1060px;
  margin: 0 auto;
  padding: 24px 24px 40px;
}

/* ───── DROP ZONE ───── */
.drop-zone {
  border: 1px dashed rgba(255,235,180,0.14);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  background: var(--surface);
  margin-bottom: 10px;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent-border);
  border-style: solid;
  background: var(--surface-2);
}

.drop-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  color: var(--text-muted);
  transition: all 0.2s ease;
}
.drop-zone:hover .drop-icon, .drop-zone.dragover .drop-icon {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent);
  animation: floatUpDown 1.2s ease-in-out infinite;
}
@keyframes floatUpDown {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-5px); }
}

.drop-text { font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 3px; }
.drop-link { color: var(--accent); font-weight: 600; }
.drop-hint { font-size: 12px; color: var(--text-muted); }

/* ───── NOTE BOX ───── */
.note-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 10px 9px 12px;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
.note-box:focus-within { border-color: var(--border-mid); }

.note-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  resize: none;
  min-height: 22px;
  max-height: 140px;
  overflow-y: auto;
}
.note-input::placeholder { color: var(--text-faint); }

.note-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border: none;
  border-radius: 5px;
  background: var(--accent);
  color: #0e0c09;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--t), transform 0.1s ease;
}
.note-send:hover { background: #d49218; }
.note-send:active { transform: scale(0.9); }
.note-send:disabled { background: var(--surface-3); color: var(--text-faint); cursor: default; }

/* ───── NOTE CARD ───── */
.file-card.note-card .file-thumb { display: none; }

.file-card.note-card {
  border-left: 2px solid rgba(232,160,32,0.25);
}

.note-content {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 12px 12px 4px;
  max-height: 110px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, black 55%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 55%, transparent 100%);
}

/* ───── UPLOAD PROGRESS ───── */
.upload-progress-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 8px;
}

.upload-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: center;
  animation: cardIn 0.2s ease both;
}

.upload-item-name {
  font-size: 12px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
}

.upload-item-pct {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
}

.progress-track {
  height: 2px;
  background: var(--surface-3);
  border-radius: 1px;
  overflow: hidden;
  grid-column: 1;
}

.progress-fill {
  height: 100%;
  width: var(--pct, 0%);
  background: var(--accent);
  border-radius: 1px;
  transition: width 0.15s ease;
  position: relative;
  overflow: hidden;
}
.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: progressShimmer 1s ease-in-out infinite;
}
@keyframes progressShimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(300%); }
}

/* ───── TABS ───── */
.tabs-wrapper {
  margin-bottom: 18px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs-wrapper::-webkit-scrollbar { display: none; }

.tabs {
  display: flex;
  min-width: max-content;
  border-bottom: 1px solid var(--border);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 20px;
  background: var(--surface-3);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.tab.active .badge { background: var(--accent-dim); color: var(--accent); }
.badge:empty { display: none; }

/* ───── FILE GRID ───── */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 9px;
}
@media (max-width: 480px) {
  .file-grid { grid-template-columns: repeat(2, 1fr); gap: 7px; }
}

/* ───── FILE CARD ───── */
.file-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: default;
  position: relative;
  animation: cardIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              border-color 0.15s,
              box-shadow 0.2s;
}
.file-card:nth-child(1)  { animation-delay: 0ms }
.file-card:nth-child(2)  { animation-delay: 35ms }
.file-card:nth-child(3)  { animation-delay: 70ms }
.file-card:nth-child(4)  { animation-delay: 105ms }
.file-card:nth-child(5)  { animation-delay: 140ms }
.file-card:nth-child(6)  { animation-delay: 175ms }
.file-card:nth-child(7)  { animation-delay: 210ms }
.file-card:nth-child(8)  { animation-delay: 245ms }
.file-card:nth-child(9)  { animation-delay: 270ms }
.file-card:nth-child(10) { animation-delay: 295ms }
.file-card:nth-child(11) { animation-delay: 315ms }
.file-card:nth-child(12) { animation-delay: 335ms }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.file-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-mid);
  box-shadow: 0 10px 28px rgba(0,0,0,0.5);
}
.file-card.favorite { border-color: rgba(232,160,32,0.22); }
.file-card.favorite:hover { border-color: rgba(232,160,32,0.4); }

.file-thumb {
  aspect-ratio: 4/3;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  position: relative;
}
.file-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.file-card:hover .file-thumb img { transform: scale(1.05); }

.file-type-icon {
  width: 40px; height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--surface-3);
}

.file-info { padding: 9px 10px 10px; }

.file-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 3px;
}

.file-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 7px;
  font-variant-numeric: tabular-nums;
}

.file-expiry {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}
.expiry-ok     { color: var(--text-faint); }
.expiry-soon   { color: var(--warning);  background: rgba(184,125,16,0.1); }
.expiry-urgent { color: var(--danger);   background: var(--danger-dim); }
.expiry-fav    { color: var(--accent);   background: var(--accent-dim); }

.file-actions { display: flex; align-items: center; gap: 1px; }

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: background var(--t), color var(--t), transform 0.1s ease;
  flex-shrink: 0;
}
.action-btn:hover { background: var(--surface-3); color: var(--text-muted); }
.action-btn:active { transform: scale(0.85); }
.action-btn.active { color: var(--accent); }
.action-btn.delete:hover { color: var(--danger); background: var(--danger-dim); }
.action-btn svg { pointer-events: none; }

.action-btn.action-favorite.pop {
  animation: starPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes starPop {
  0%   { transform: scale(1) rotate(0); }
  45%  { transform: scale(1.55) rotate(-18deg); }
  100% { transform: scale(1) rotate(0); }
}

.fav-overlay {
  position: absolute;
  top: 5px; right: 5px;
  width: 20px; height: 20px;
  border-radius: 4px;
  background: rgba(14,12,9,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 10px;
}

/* ───── EMPTY STATE ───── */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 56px 24px;
  text-align: center;
  gap: 5px;
  animation: cardIn 0.3s ease both;
}
.empty-state-icon { font-size: 32px; opacity: 0.18; margin-bottom: 8px; }
.empty-state h3 { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.empty-state p  { font-size: 13px; color: var(--text-faint); max-width: 220px; }

/* ───── SKELETON ───── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: 3px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ───── TOAST ───── */
.toast-container {
  position: fixed;
  bottom: 20px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.55);
  animation: toastIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 180px;
  max-width: 280px;
  pointer-events: auto;
  color: var(--text-muted);
}
.toast-success { border-left: 2px solid var(--success); }
.toast-error   { border-left: 2px solid var(--danger); }
.toast-info    { border-left: 2px solid var(--surface-3); }
.toast-exit    { animation: toastOut 0.2s ease forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(12px); }
}

/* ───── FOOTER ───── */
.footer {
  text-align: center;
  padding: 12px 24px 36px;
  max-width: 1060px;
  margin: 0 auto;
}
.footer-link {
  font-size: 12px;
  color: var(--text-faint);
  text-decoration: none;
  transition: color var(--t);
}
.footer-link:hover { color: var(--text-muted); }
.footer-link strong { font-weight: 600; }

/* ───── RESPONSIVE ───── */
@media (max-width: 600px) {
  .auth-card  { padding: 28px 18px 24px; }
  .main       { padding: 14px 12px 32px; }
  .header     { padding: 0 14px; }
  .footer     { padding: 10px 12px 28px; }
}
