:root {
  --primary: #0a84ff;
  --primary-dark: #0066cc;
  --secondary: #5e5ce6;
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #1e293b 100%);
  --white: #ffffff;
  --black: #000000;
  --accent: #00d2ff;
  --gray-100: #f2f2f7;
  --gray-200: #e5e5ea;
  --gray-300: #d1d1d6;
  --gray-400: #c7c7cc;
  --gray-500: #8e8e93;
  --gray-600: #48484a;
  --gray-700: #3a3a3c;
  --gray-800: #2c2c2e;
  --gray-900: #1c1c1e;
  --glass: rgba(255, 255, 255, 0.15);
  --glass-dark: rgba(0, 0, 0, 0.3);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.2);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --success: #30d158;
  --danger: #ff453a;
  --warning: #ff9f0a;
}

/* Safari-specific fixes */
@supports (-webkit-backdrop-filter: blur(10px)) or (backdrop-filter: blur(10px)) {
  .glass-effect {
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
  }
}


body.light-mode {
  --bg-gradient: #f2f2f7;
  --white: #1c1c1e;
  --black: #ffffff;
  --gray-100: #e5e5ea;
  --gray-400: #8e8e93;
  --glass: rgba(255, 255, 255, 0.85);
  /* More opaque for light mode */
  --glass-dark: rgba(255, 255, 255, 0.5);
}

body.light-mode .card,
body.light-mode .navbar,
body.light-mode .bottom-nav {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .btn-outline {
  border-color: rgba(0, 0, 0, 0.2);
  color: var(--white);
  background: rgba(0, 0, 0, 0.05);
}

body.light-mode .input-ios {
  background: rgba(0, 0, 0, 0.05);
  color: var(--white);
  border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .input-ios::placeholder {
  color: rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-gradient);
  color: var(--white);
  line-height: 1.5;
  overflow-x: hidden;
}

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

.full-screen-center {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.app-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 24px 100px;
}

/* CONTAINERS & CARDS */
.container {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.card.elevated {
  background: var(--white);
  color: var(--black);
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  text-align: left;
}

/* TYPOGRAPHY */
h1 {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}

h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
}

p {
  font-size: 16px;
  opacity: 0.9;
  margin-bottom: 24px;
}

.text-sm {
  font-size: 13px;
  color: var(--gray-400);
}

.text-center {
  text-align: center;
}

.text-white {
  color: var(--white);
}

.text-primary {
  color: var(--primary);
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px 24px;
  border-radius: var(--radius-md);
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--white);
  color: var(--primary);
}

.btn-primary:hover {
  background: var(--gray-100);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--white);
  backdrop-filter: blur(5px);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
}

.btn-ghost {
  background: transparent;
  color: var(--white);
}

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

/* FORMS */
.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.8);
}

.input-ios {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  font-size: 16px;
  transition: var(--transition);
}

.input-ios:focus {
  outline: none;
  border-color: var(--white);
  background: rgba(255, 255, 255, 0.15);
}

.input-ios::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* NAVBAR */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  z-index: 2000;
}

.nav-brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 15px;
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-item {
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.nav-item.active,
.nav-item:hover {
  color: var(--white);
}

/* DASHBOARD GRID & UTILS */
.dashboard-grid {
  display: grid;
  grid-template-columns: 240px 1fr 340px;
  gap: 24px;
  margin-top: 24px;
}

@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: 240px 1fr;
  }

  /* Don't hide, let it stack below if needed or stay in 2nd column if room */
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .sidebar-container {
    display: none;
    /* Sidebar still hidden on small mobile */
  }
}

.sidebar-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 100px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-nav-item:hover,
.sidebar-nav-item.active {
  background: rgba(0, 122, 255, 0.15);
  color: var(--primary);
  transform: translateX(5px);
}

.sidebar-nav-item i {
  width: 18px;
  height: 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
}

.span-12 {
  grid-column: span 12;
}

.span-6 {
  grid-column: span 6;
}

.span-4 {
  grid-column: span 4;
}

.span-3 {
  grid-column: span 3;
}

@media (max-width: 850px) {

  .dashboard-grid,
  .grid {
    grid-template-columns: 1fr;
  }

  .span-6,
  .span-4,
  .span-3 {
    grid-column: span 1;
  }
}

#share {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#share .btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#share .btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
  box-shadow: 0 4px 15px rgba(10, 132, 255, 0.3);
}

/* CONTEXT MENU */
.context-menu {
  position: fixed;
  background: rgba(28, 28, 30, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  width: 180px;
  z-index: 2000;
  box-shadow: var(--shadow-md);
  padding: 8px;
  display: none;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  transition: background 0.2s;
}

.context-menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.context-menu-item.danger {
  color: var(--danger);
}

.context-menu-item.danger:hover {
  background: rgba(255, 69, 58, 0.15);
}

/* MODAL */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 3000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: var(--gray-900);
  width: 90%;
  max-width: 450px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 30px;
  position: relative;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.kit {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* FILE LIST */
.file-row {
  display: flex;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: var(--transition);
}

.file-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.file-name {
  flex: 1;
  text-align: left;
  font-weight: 500;
}

/* INDICATORS (DOTS) */
.pagination-dots {
  display: flex;
  gap: 8px;
  margin-bottom: 40px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transition: var(--transition);
}

.dot.active {
  background: var(--white);
  width: 24px;
  border-radius: 4px;
}

/* PROGRESS BAR */
.progress-container {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  margin: 12px 0;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--white);
  border-radius: 4px;
}

/* BOTTOM NAV */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1000;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  gap: 4px;
  cursor: pointer;
  transition: var(--transition);
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: var(--white);
}

/* UTILS */
.glass-effect {
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.mt-20 {
  margin-top: 20px;
}

.mt-40 {
  margin-top: 40px;
}

.mb-15 {
  margin-bottom: 15px;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.close-btn {
  position: absolute;
  top: 20px;
  right: 24px;
  font-size: 28px;
  color: var(--white);
  text-decoration: none;
  opacity: 0.7;
}

.close-btn:hover {
  opacity: 1;
}

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

/* COMPATIBILITY CLASSES (for JS) */
.file {
  display: flex;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: var(--transition);
}

.file:hover {
  background: rgba(255, 255, 255, 0.05);
}

.file .name {
  flex: 1;
  font-weight: 500;
}

.file .sec {
  font-size: 13px;
  color: var(--gray-400);
  margin-left: 12px;
}

.pill {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.upload-toast {
  position: fixed;
  bottom: 100px;
  right: 24px;
  background: var(--gray-900);
  width: 280px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 10000;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.file-row.selected {
  background: rgba(10, 132, 255, 0.1) !important;
  border-left: 3px solid var(--primary);
}

/* AVATARS */
.avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: white;
  margin-right: 20px;
  box-shadow: var(--shadow-md);
  border: 3px solid rgba(255, 255, 255, 0.1);
}

.avatar-small {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  margin-right: 10px;
  box-shadow: var(--shadow-sm);
}

.file-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: var(--transition);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.file-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
}

.file-info {
  flex: 1;
}

.file-name {
  font-weight: 600;
  font-size: 14px;
}

.file-meta {
  font-size: 11px;
  color: var(--gray-500);
}

.btn-ghost {
  background: transparent;
  border: none;
  padding: 8px;
  color: var(--gray-500);
  cursor: pointer;
  border-radius: 50%;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.upload-toast {
  background: rgba(28, 28, 30, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: slideIn 0.3s ease;
}

.upload-container {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.upload-container::-webkit-scrollbar {
  width: 6px;
}

.upload-container::-webkit-scrollbar-track {
  background: transparent;
}

.upload-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

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

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Switch Styles */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  vertical-align: middle;
  margin: 0 8px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--gray-600);
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: '';
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked+.slider {
  background-color: var(--primary);
}

input:checked+.slider:before {
  transform: translateX(20px);
}