/* Design System - SimpleSecureShare */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* =============================================
   LIGHT MODE TOKENS (default)
   ============================================= */
:root {
  /* Backgrounds */
  --bg-app: #f1f5f9;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  --bg-overlay: rgba(15, 23, 42, 0.4);

  /* Text */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* Primary (Indigo) */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  --primary-focus: rgba(79, 70, 229, 0.15);

  /* Danger */
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: #fee2e2;

  /* Success */
  --success: #10b981;
  --success-light: #d1fae5;

  /* Warning */
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --warning-text: #92400e;
  --success-text: #065f46;

  /* Borders */
  --border: #e2e8f0;
  --border-focus: #cbd5e1;

  /* Shadows */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.08);
  --shadow-premium: 0 20px 25px -5px rgba(79, 70, 229, 0.05), 0 8px 10px -6px rgba(79, 70, 229, 0.05);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  /* Transitions */
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-theme: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;

  /* Login gradient */
  --login-gradient: radial-gradient(circle at 10% 20%, rgba(224, 231, 255, 0.3) 0%, rgba(241, 245, 249, 1) 90%);

  /* File icon backgrounds */
  --file-icon-img-bg: #fee2e2;
  --file-icon-img-color: #ef4444;
  --file-icon-zip-bg: #fef3c7;
  --file-icon-zip-color: #d97706;
  --file-icon-exe-bg: #e0f2fe;
  --file-icon-exe-color: #0284c7;
  --file-icon-txt-bg: #f1f5f9;
  --file-icon-txt-color: #475569;
  --file-icon-code-bg: #e0e7ff;
  --file-icon-code-color: #4f46e5;
  --file-icon-default-bg: #f1f5f9;
  --file-icon-default-color: #475569;

  /* TOTP secret code */
  --totp-secret-bg: #ffffff;
}

/* =============================================
   DARK MODE TOKENS
   ============================================= */
[data-theme="dark"] {
  /* Backgrounds */
  --bg-app: #0f172a;
  --bg-card: #1e293b;
  --bg-input: #0f172a;
  --bg-overlay: rgba(0, 0, 0, 0.6);

  /* Text */
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;

  /* Primary (Indigo – slightly lighter for dark bg) */
  --primary: #818cf8;
  --primary-hover: #6366f1;
  --primary-light: rgba(99, 102, 241, 0.15);
  --primary-focus: rgba(129, 140, 248, 0.2);

  /* Danger */
  --danger: #f87171;
  --danger-hover: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.15);

  /* Success */
  --success: #34d399;
  --success-light: rgba(52, 211, 153, 0.12);

  /* Warning */
  --warning: #fbbf24;
  --warning-light: rgba(251, 191, 36, 0.12);
  --warning-text: #fbbf24;
  --success-text: #34d399;

  /* Borders */
  --border: #334155;
  --border-focus: #475569;

  /* Shadows (stronger on dark bg) */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --shadow-premium: 0 20px 25px -5px rgba(99, 102, 241, 0.1), 0 8px 10px -6px rgba(99, 102, 241, 0.1);

  /* Login gradient */
  --login-gradient: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.1) 0%, rgba(15, 23, 42, 1) 90%);

  /* File icon backgrounds (desaturated on dark) */
  --file-icon-img-bg: rgba(239, 68, 68, 0.15);
  --file-icon-img-color: #f87171;
  --file-icon-zip-bg: rgba(217, 119, 6, 0.15);
  --file-icon-zip-color: #fbbf24;
  --file-icon-exe-bg: rgba(2, 132, 199, 0.15);
  --file-icon-exe-color: #38bdf8;
  --file-icon-txt-bg: rgba(71, 85, 105, 0.2);
  --file-icon-txt-color: #94a3b8;
  --file-icon-code-bg: rgba(99, 102, 241, 0.15);
  --file-icon-code-color: #818cf8;
  --file-icon-default-bg: rgba(71, 85, 105, 0.2);
  --file-icon-default-color: #94a3b8;

  /* TOTP secret code */
  --totp-secret-bg: #0f172a;
}

/* =============================================
   BASE RESET & BODY
   ============================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: var(--transition-theme);
}

/* Typography Helpers */
h1, h2, h3, h4 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--text-main);
  transition: var(--transition-theme);
}

/* Layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* =============================================
   LOGIN
   ============================================= */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  background: var(--login-gradient);
  transition: var(--transition-theme);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 440px;
  text-align: center;
  animation: fadeIn 0.4s ease-out;
  transition: var(--transition-theme);
}

.brand-header {
  margin-bottom: 2.5rem;
}

.brand-icon {
  background: var(--primary-light);
  color: var(--primary);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  transition: var(--transition-theme);
}

.brand-icon svg {
  width: 32px;
  height: 32px;
}

.brand-title {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

.brand-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* =============================================
   FORMS
   ============================================= */
.form-group {
  margin-bottom: 1.5rem;
  text-align: left;
}

.form-label {
  display: block;
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
  transition: var(--transition-theme);
}

.input-control {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--bg-input);
  color: var(--text-main);
  transition: var(--transition);
}

.input-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-focus);
  background-color: var(--bg-card);
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  gap: 0.5rem;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  width: 100%;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-main);
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--border);
}

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

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-danger-outline {
  background-color: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.btn-danger-outline:hover {
  background-color: var(--danger-light);
}

.btn-icon {
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--bg-input);
  color: var(--text-main);
}

.btn-icon-danger {
  color: var(--danger);
}

.btn-icon-danger:hover {
  background: var(--danger-light);
  border-color: var(--danger);
  color: var(--danger);
}

/* =============================================
   DASHBOARD HEADER
   ============================================= */
.dash-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-theme);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-left svg {
  color: var(--primary);
  width: 28px;
  height: 28px;
}

.header-left h1 {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--transition-theme);
}

.user-badge svg {
  width: 16px;
  height: 16px;
}

/* Theme toggle button */
.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: var(--transition);
  padding: 0;
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  background: var(--bg-input);
  color: var(--text-main);
  border-color: var(--border-focus);
}

/* =============================================
   MAIN DASHBOARD WORKSPACE
   ============================================= */
.dash-main {
  flex: 1;
  padding: 2rem;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 2rem;
}

@media (max-width: 1024px) {
  .dash-main {
    grid-template-columns: 1fr;
  }
}

.dash-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: fadeIn 0.3s ease-out;
  transition: var(--transition-theme);
}

.panel-title {
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.panel-title svg {
  color: var(--primary);
  width: 20px;
  height: 20px;
}

/* =============================================
   DRAG & DROP
   ============================================= */
.drag-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  background: var(--bg-input);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.drag-zone.dragging {
  border-color: var(--primary);
  background-color: var(--primary-light);
  transform: scale(0.98);
}

.drag-icon {
  color: var(--primary);
  transition: var(--transition);
}

.drag-zone:hover .drag-icon {
  transform: translateY(-4px);
}

.drag-text {
  font-size: 0.95rem;
  font-weight: 500;
}

.drag-subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* File Input Hidden */
#file-input {
  display: none;
}

/* =============================================
   UPLOAD PROGRESS
   ============================================= */
.progress-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 200px;
  overflow-y: auto;
}

.upload-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: var(--transition-theme);
}

.upload-item-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 500;
}

.upload-item-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}

.upload-progress-bar {
  background: var(--border);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}

.upload-progress-fill {
  background: var(--primary);
  height: 100%;
  width: 0%;
  transition: width 0.1s linear;
}

/* =============================================
   FILE EXPLORER
   ============================================= */
.explorer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.search-wrapper {
  position: relative;
  width: 100%;
  max-width: 300px;
}

.search-input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.25rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-main);
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

/* Explorer Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.file-table th {
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  background: var(--bg-card);
  transition: var(--transition-theme);
}

.file-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: middle;
  transition: var(--transition-theme);
}

.file-table tr:hover td {
  background: var(--bg-input);
}

.file-row-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.file-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-theme);
}

.file-icon-img   { background: var(--file-icon-img-bg);     color: var(--file-icon-img-color); }
.file-icon-pdf   { background: var(--file-icon-img-bg);     color: var(--file-icon-img-color); }
.file-icon-zip   { background: var(--file-icon-zip-bg);     color: var(--file-icon-zip-color); }
.file-icon-exe   { background: var(--file-icon-exe-bg);     color: var(--file-icon-exe-color); }
.file-icon-txt   { background: var(--file-icon-txt-bg);     color: var(--file-icon-txt-color); }
.file-icon-code  { background: var(--file-icon-code-bg);    color: var(--file-icon-code-color); }
.file-icon-default { background: var(--file-icon-default-bg); color: var(--file-icon-default-color); }

.file-name {
  font-weight: 500;
  color: var(--text-main);
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.file-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.empty-state svg {
  color: var(--text-light);
  width: 64px;
  height: 64px;
}

/* =============================================
   HELP ACCORDION
   ============================================= */
.help-accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.help-item {
  border-bottom: 1px solid var(--border);
}

.help-item:last-child {
  border-bottom: none;
}

.help-header {
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: var(--transition-theme);
}

.help-content {
  padding: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-card);
  display: none;
  transition: var(--transition-theme);
}

.help-content code {
  background: var(--bg-input);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-family: monospace;
  color: var(--primary);
}

.help-item.active .help-content {
  display: block;
}

.help-item.active .help-header svg {
  transform: rotate(180deg);
}

.help-header svg {
  width: 16px;
  height: 16px;
  transition: var(--transition);
}

/* =============================================
   TOASTS
   ============================================= */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 1rem 1.25rem;
  min-width: 300px;
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  pointer-events: auto;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: var(--transition), var(--transition-theme);
}

.toast-success { border-left-color: var(--success); }
.toast-error   { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon   { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }

.toast-message {
  font-size: 0.875rem;
  font-weight: 500;
  flex: 1;
  color: var(--text-main);
}

.toast-close {
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.toast-close:hover {
  color: var(--text-main);
}

/* =============================================
   MODALS
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  width: 90%;
  max-width: 440px;
  animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: var(--transition-theme);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.modal-header svg {
  color: var(--danger);
  width: 24px;
  height: 24px;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-body {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* =============================================
   ANIMATIONS
   ============================================= */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateX(100px); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}
