/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Prevent language flash: body hidden until JS marks it ready */
body {
  opacity: 0;
  transition: opacity 0.08s ease;
}

body.ready {
  opacity: 1;
}

:root {
  --bg-color: #0b101e;
  --text-primary: #ffffff;
  --text-secondary: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --bubble-1: #1e3a8a;
  --bubble-2: #312e81;
  --bubble-3: #0c4a6e;

  --font-heading: "Playfair Display", serif;
  --font-body: "Inter", sans-serif;

  --radius-lg: 24px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-glass: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  --input-bg: rgba(255, 255, 255, 0.05);
}

:root.light {
  --bg-color: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.05);
  --bubble-1: #bae6fd;
  --bubble-2: #c7d2fe;
  --bubble-3: #ddd6fe;
  --shadow-glass: 0 20px 40px -10px rgba(0, 0, 0, 0.05);
  --input-bg: #ffffff;
}

.bg-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  background: var(--bg-color);
  transition: background-color 0.3s ease;
}

.bubble {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.6;
  animation: float 20s infinite ease-in-out alternate;
}

.bubble-1 {
  width: 600px;
  height: 600px;
  background: var(--bubble-1);
  top: -100px;
  left: -100px;
  animation-delay: 0s;
}

.bubble-2 {
  width: 800px;
  height: 800px;
  background: var(--bubble-2);
  bottom: -200px;
  right: -200px;
  animation-delay: -5s;
}

.bubble-3 {
  width: 500px;
  height: 500px;
  background: var(--bubble-3);
  top: 30%;
  left: 40%;
  animation-delay: -10s;
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(50px, 50px) scale(1.1);
  }
}

/* Typography */
h1,
h2,
h3,
.title {
  font-family: var(--font-heading);
  font-weight: 600;
}

/* Navigation */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 4rem;
  position: relative;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.logo-container {
  position: relative;
  width: 4rem;
  /* Doubled from roughly 2rem */
  height: 4rem;
}

.logo-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.3s ease;
}

/* Default Dark Mode: show dark logo, hide light logo */
.logo-dark {
  opacity: 1;
}

.logo-light {
  opacity: 0;
}

/* Light Mode: hide dark logo, show light logo */
:root.light .logo-dark {
  opacity: 0;
}

:root.light .logo-light {
  opacity: 1;
}

:root.light .logo img {
  filter: invert(1);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-links button {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s ease;
}

.nav-links button:hover {
  color: var(--text-primary);
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
  font-size: 0.95rem;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

/* Container & Layout */
.container {
  max-width: 800px;
  margin: 4rem auto;
  padding: 0 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 10;
}

.title {
  font-size: 4rem;
  line-height: 1.1;
  margin-bottom: 1rem;
  background: linear-gradient(
    180deg,
    var(--text-primary) 0%,
    var(--text-secondary) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 500px;
  margin-bottom: 3rem;
}

/* Glass Panel */
.glass-panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 3rem;
  width: 100%;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-glass);
  transition: transform 0.3s ease;
}

/* Upload Area */
.upload-area {
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius-md);
  padding: 4rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  transition: all 0.3s ease;
  background: var(--input-bg);
}

.upload-area.dragging {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
  transform: scale(1.02);
}

.upload-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

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

.upload-area h3 {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-primary);
}

.upload-area p {
  color: var(--text-secondary);
}

.file-limits {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 1rem;
}

/* Forms & Inputs */
.options-area {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-start;
  text-align: left;
  width: 100%;
}

.toggle-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  color: var(--text-primary);
}

.toggle-control input[type="checkbox"] {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 1px solid var(--text-secondary);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.toggle-control input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-control input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 4px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.password-control {
  width: 100%;
  margin-top: 0;
}

input[type="password"],
input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--input-bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s ease;
  margin-top: 0.5rem;
}

select option {
  background: var(--bg-color);
  color: var(--text-primary);
}

input:focus,
select:focus {
  border-color: var(--accent);
}

.exp-control {
  display: flex;
  gap: 1rem;
  align-items: center;
  width: 100%;
  margin-top: 0.5rem;
  color: var(--text-primary);
}

.exp-control input {
  width: 80px;
  margin-top: 0;
}

.exp-control select {
  width: auto;
  flex-grow: 1;
  margin-top: 0;
}

/* Buttons */
.btn-primary {
  background: var(--text-primary);
  color: var(--bg-color);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

.modal-content {
  background: var(--bg-color);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 2.5rem;
  width: 90%;
  max-width: 450px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-content h2 {
  margin-bottom: 2rem;
  font-size: clamp(1rem, 4vw, 1.5rem);
  color: var(--text-primary);
  word-break: break-all;
  overflow-wrap: break-word;
}

/* Progress */
.progress-wrapper {
  width: 100%;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--glass-border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* URL Result */
.url-box {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.url-box input {
  margin-top: 0;
  background: var(--input-bg);
}

/* File List Page */
.file-list-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  text-align: left;
}

.storage-dashboard {
  width: 100%;
  background: transparent;
  border: none;
  padding: 0 0 1.5rem 0;
  margin-bottom: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}

.storage-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.storage-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.storage-bar-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.5s ease;
}

.storage-bar-fill.danger {
  background: #ef4444;
  /* Red for >90% */
}

/* Table */
.file-table-wrapper {
  width: 100%;
  overflow-x: auto;
  text-align: left;
}

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

.file-table th,
.file-table td {
  padding: 1rem 0.5rem;
  border-bottom: 1px solid var(--glass-border);
  font-size: 0.9rem;
}

.file-table td {
  color: var(--text-secondary);
}

.file-table th {
  color: var(--text-secondary);
  font-weight: 500;
}

.tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Disabled action buttons (private files on non-admin) */
.action-btn.disabled {
  opacity: 0.25;
  cursor: not-allowed;
  pointer-events: none;
}

.tag {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--glass-border);
  color: var(--text-secondary);
}

.tag.locked {
  background: rgba(59, 130, 246, 0.2);
  color: var(--accent);
}

.action-btns {
  display: flex;
  gap: 0.5rem;
}

.action-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  transition: color 0.2s ease;
}

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

.action-btn.delete:hover {
  color: #ef4444;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-color);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font-body);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateX(40px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  pointer-events: auto;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast.success {
  border-left: 3px solid #22c55e;
}

.toast.error {
  border-left: 3px solid #ef4444;
}

/* Confirm Modal */
.confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.confirm-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.confirm-box {
  background: var(--bg-color);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 2rem;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.confirm-box p {
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.confirm-actions button {
  padding: 0.5rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.confirm-actions .confirm-cancel {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}

.confirm-actions .confirm-cancel:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.confirm-actions .confirm-ok {
  background: #ef4444;
  border: none;
  color: #fff;
}

.confirm-actions .confirm-ok:hover {
  background: #dc2626;
}
