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

:root {
  --bg-main: #050505;
  --bg-panel: #0a0a0f;
  --bg-panel-2: #08080c;
  --border: #1a1a1a;
  --text-main: #f0f0f0;
  --text-muted: #888;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --card-shadow: 0 4px 6px rgba(0, 0, 0, .1);
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --text: #f8fafc;
  --bg: #0f172a;
  --bg-light: #1e293b;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -4px rgba(0, 0, 0, .1);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  padding-top: 60px; /* Reduced for mobile */
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem; /* Reduced padding for mobile */
  width: 100%;
}

h1 {
  font-size: 1.8rem; /* Smaller for mobile */
  font-weight: 800;
  letter-spacing: -0.3px; /* Reduced for mobile */
  line-height: 1.3;
}

h2 {
  font-size: 1.6rem; /* Smaller for mobile */
  font-weight: 600;
  margin-bottom: 1rem;
  line-height: 1.3;
}

h3 {
  font-size: 1rem; /* Smaller for mobile */
  font-weight: 700;
  color: var(--text-muted);
}

p {
  font-size: 0.9rem; /* Smaller for mobile */
  color: var(--text-muted);
  line-height: 1.5;
}

.gradient-text {
  background: linear-gradient(90deg, #5e6064, #b1b0b5);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background: rgba(8, 8, 8, .98);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.nav-inner {
  max-width: 1100px;
  margin: auto;
  padding: 0.75rem 1rem; /* Reduced padding for mobile */
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.logo {
  font-size: 1.2rem; /* Smaller for mobile */
  font-weight: 800;
  white-space: nowrap;
}

.logo span {
  color: #60a5fa;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.25rem; /* Smaller for mobile */
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 10px; /* Slightly smaller radius */
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  min-height: 44px; /* Minimum touch target size */
  min-width: 44px; /* Minimum touch target size */
  transition: all 0.2s ease;
}

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

.btn-secondary,
.navbar button,
#btn_logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem; /* Smaller for mobile */
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 8px; /* Slightly smaller radius */
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.9rem;
  min-height: 36px; /* Minimum touch target size */
  min-width: 36px; /* Minimum touch target size */
}

.btn-secondary:hover,
.navbar button:hover,
#btn_logout:hover {
  background: rgba(255, 255, 255, .03);
  border-color: #374151;
}

.btn-secondary:active,
.navbar button:active,
#btn_logout:active {
  background: rgba(255, 255, 255, .05);
}

/* Hero Section */
.hero {
  max-width: 1100px;
  margin: auto;
  padding: 3rem 1rem 2rem; /* Reduced padding for mobile */
  display: flex;
  flex-direction: column; /* Stack on mobile */
  gap: 2rem;
}

.hero-content {
  width: 100%;
}

.hero-content h1 {
  margin-bottom: 1rem;
}

.hero-content p {
  max-width: 100%; /* Full width on mobile */
  margin-bottom: 1.5rem;
}

.hero-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem; /* Reduced padding for mobile */
  box-shadow: var(--card-shadow);
  width: 100%;
}

.hero-card ul {
  list-style: none;
}

.hero-card li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem; /* Smaller for mobile */
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hero-card li:last-child {
  border-bottom: none;
}

/* Auth Wrapper */
.auth-wrapper {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, var(--bg-panel), var(--bg-panel-2));
  border: 1px solid var(--border);
  border-radius: 16px; /* Slightly smaller radius */
  padding: 1.75rem; /* Reduced padding for mobile */
  box-shadow: 0 20px 40px rgba(0, 0, 0, .6);
  animation: fadeIn .3s ease;
  margin: auto;
}

.brand {
  text-align: center;
  font-size: 1.3rem; /* Smaller for mobile */
  font-weight: 800;
  margin-bottom: 1.25rem;
}

.brand span {
  color: #60a5fa;
}

.auth-card h1 {
  text-align: center;
  margin-bottom: 0.5rem;
  font-size: 1.5rem; /* Smaller for mobile */
}

.auth-subtitle {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 0.9rem; /* Smaller for mobile */
}

/* Forms */
.form-group {
  margin-bottom: 1rem; /* Reduced for mobile */
}

label {
  display: block;
  font-size: 0.8rem; /* Smaller for mobile */
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="file"] {
  width: 100%;
  padding: 0.75rem; /* Reduced padding for mobile */
  border-radius: 10px; /* Slightly smaller radius */
  border: 1px solid var(--border);
  background: #121212;
  color: var(--text-main);
  font-size: 0.9rem; /* Smaller for mobile */
  min-height: 44px; /* Minimum touch target size */
}

input::placeholder {
  color: #6b7280;
  font-size: 0.9rem; /* Smaller for mobile */
}

input:focus {
  outline: none;
  border-color: #374151;
  background: #050607;
}

input[type="file"]::file-selector-button {
  background: #374151;
  color: #fff;
  border: none;
  padding: 0.5rem 0.75rem; /* Reduced padding for mobile */
  border-radius: 8px; /* Slightly smaller radius */
  cursor: pointer;
  margin-right: 0.75rem;
  font-size: 0.85rem; /* Smaller for mobile */
}

input[type="file"]::file-selector-button:hover {
  background: #4b5563;
}

.separator {
  display: flex;
  align-items: center;
  gap: 0.75rem; /* Reduced gap for mobile */
  margin: 1.5rem 0; /* Reduced margin for mobile */
  font-size: 0.8rem; /* Smaller for mobile */
  color: #6b7280;
}

.separator:before,
.separator:after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-footer {
  text-align: center;
  font-size: 0.85rem; /* Smaller for mobile */
}

.auth-footer a {
  color: #60a5fa;
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* File Items */
.file-item {
  background: #121217;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem; /* Reduced padding for mobile */
  margin-bottom: 0.75rem; /* Reduced margin for mobile */
}

.file-item strong {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.95rem; /* Smaller for mobile */
}

.dashboard-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 5rem 1rem 2rem; /* Reduced padding for mobile */
  width: 100%;
}

.file-url {
  font-family: monospace;
  font-size: 0.8rem; /* Smaller for mobile */
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  color: #9ca3af;
  word-break: break-all; /* Break long URLs */
  overflow-wrap: break-word;
}

.btn-delete,
#btn_delete_account {
  background: var(--danger);
  border: none;
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem; /* Smaller for mobile */
  min-height: 36px; /* Minimum touch target size */
  min-width: 36px; /* Minimum touch target size */
}

.btn-delete:hover,
#btn_delete_account:hover {
  background: #d33b3b;
}

#files_list:empty:after {
  content: "No files uploaded yet.";
  display: block;
  text-align: center;
  padding: 2rem;
  color: #6b7280;
  font-style: italic;
  font-size: 0.9rem; /* Smaller for mobile */
}

.error-message {
  color: #ff4d4f;
  margin: 8px 0;
  font-size: 0.85rem; /* Smaller for mobile */
  display: none;
}

/* Hero Image */
.hero-image {
  width: 100%;
  border-radius: 12px; /* Slightly smaller radius */
  overflow: hidden;
  box-shadow: var(--shadow);
}

.hero-image img {
  width: 100%;
  height: auto;
  display: block;
}

/* CTA Buttons */
.cta-buttons {
  display: flex;
  flex-direction: column; /* Stack buttons on mobile */
  gap: 0.75rem; /* Reduced gap for mobile */
  margin-top: 1.5rem; /* Reduced margin for mobile */
  width: 100%;
}

.cta-buttons .btn-primary,
.cta-buttons .btn-secondary {
  width: 100%; /* Full width buttons on mobile */
  text-align: center;
}

/* Features Section */
.features {
  display: grid;
  grid-template-columns: 1fr; /* Single column on mobile */
  gap: 1.5rem; /* Reduced gap for mobile */
  margin: 4rem 0; /* Reduced margin for mobile */
  width: 100%;
}

.feature-card {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  background-color: #121212;
  padding: 1.5rem; /* Reduced padding for mobile */
  transition: transform .2s ease;
  width: 100%;
}

.feature-card:hover {
  transform: translateY(-5px);
}

.feature-icon {
  width: 40px; /* Smaller for mobile */
  height: 40px; /* Smaller for mobile */
  background: rgba(59, 130, 246, .1);
  border-radius: 10px; /* Slightly smaller radius */
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem; /* Reduced margin for mobile */
}

.feature-icon svg {
  width: 20px; /* Smaller for mobile */
  height: 20px; /* Smaller for mobile */
}

/* Primary/Secondary Buttons */
.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.25rem; /* Reduced padding for mobile */
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem; /* Smaller for mobile */
  text-decoration: none;
  transition: all .2s ease;
  min-height: 44px; /* Minimum touch target size */
  min-width: 44px; /* Minimum touch target size */
}

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

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

.secondary-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  margin-left: 0; /* Reset for mobile */
  margin-top: 0.75rem; /* Add spacing when stacked */
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, .05);
  transform: translateY(-1px);
}

/* Media Queries */
@media (max-width: 768px) {
  .hero {
    text-align: center;
    padding: 2rem 1rem; /* Reduced padding for mobile */
  }
  
  .cta-buttons {
    flex-direction: column;
  }
  
  .cta-buttons .btn-secondary {
    margin-left: 0;
  }
  
  .auth-card {
    padding: 1.5rem;
  }
  
  .file-item {
    padding: 0.75rem;
  }
  
  .file-url {
    font-size: 0.75rem;
  }
}

@media (min-width: 480px) {
  .cta-buttons {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .cta-buttons .btn-primary,
  .cta-buttons .btn-secondary {
    width: auto;
  }
}

@media (min-width: 768px) {
  body {
    padding-top: 80px;
  }
  
  .container {
    padding: 0 2rem;
  }
  
  h1 {
    font-size: 2.2rem;
    letter-spacing: -0.5px;
  }
  
  h2 {
    font-size: 2rem;
  }
  
  h3 {
    font-size: 1.1rem;
  }
  
  p {
    font-size: 0.95rem;
  }
  
  .nav-inner {
    padding: 1rem 2rem;
  }
  
  .logo {
    font-size: 1.4rem;
  }
  
  .hero {
    padding: 9rem 2rem 4rem;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 3rem;
    text-align: left;
  }
  
  .hero-content p {
    max-width: 520px;
  }
  
  .features {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 6rem 0;
  }
  
  .cta-buttons {
    flex-direction: row;
  }
  
  .secondary-btn {
    margin-left: 1rem;
    margin-top: 0;
  }
}

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

/* Mobile-specific improvements */
@media (max-width: 640px) {
  .navbar button,
  #btn_logout {
    padding: 0.5rem;
  }
  
  .hero-card {
    padding: 1rem;
  }
  
  .auth-card {
    padding: 1.25rem;
  }
  
  .file-item strong {
    font-size: 0.9rem;
  }
  
  .btn-delete,
  #btn_delete_account {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
  }
}

/* Prevent horizontal scrolling */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

/* Improve touch targets on iOS */
button,
input[type="button"],
input[type="submit"],
input[type="reset"],
.btn-primary,
.btn-secondary {
  -webkit-appearance: none;
  appearance: none;
}

/* Smooth scrolling for iOS */
@media (max-width: 768px) {
  * {
    -webkit-overflow-scrolling: touch;
  }
}
