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

:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --secondary-color: #64748b;
  --success-color: #22c55e;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --background: #f8fafc;
  --surface: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 0.75rem;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

nav {
  display: flex;
  gap: 1rem;
}

nav a {
  text-decoration: none;
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  transition: all 0.2s;
  font-weight: 500;
}

nav a:hover {
  background: var(--primary-color);
  color: white;
}

nav a.active {
  background: var(--primary-color);
  color: white;
}

main {
  flex: 1;
}

.upload-section {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}

.upload-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.tab-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--primary-color);
  background: rgba(99, 102, 241, 0.05);
}

.tab-btn.active {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
  margin-bottom: -2px;
}

.upload-content {
  min-height: 300px;
}

.upload-panel {
  display: none;
}

.upload-panel.active {
  display: block;
}

.upload-area {
  border: 3px dashed var(--border);
  border-radius: var(--radius);
  padding: 4rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: var(--background);
}

.upload-area:hover {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.05);
}

.upload-area.drag-over {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.1);
  transform: scale(1.02);
}

.upload-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.upload-area p {
  font-size: 1.125rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.upload-hint {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.url-upload-area {
  display: flex;
  gap: 1rem;
  padding: 2rem;
}

.url-upload-area input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: all 0.2s;
}

.url-upload-area input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

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

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

.btn-secondary:hover {
  background: #475569;
}

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

.btn-danger:hover {
  background: #dc2626;
}

.upload-progress {
  margin-top: 2rem;
}

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

.progress-fill {
  height: 100%;
  background: var(--primary-color);
  transition: width 0.3s;
  border-radius: 1rem;
}

#progress-text {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.upload-result {
  margin-top: 2rem;
}

.result-item {
  background: var(--background);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--success-color);
}

.result-item.error {
  border-left-color: var(--danger-color);
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.result-title {
  font-weight: 600;
  color: var(--text-primary);
}

.result-preview {
  width: 100%;
  max-width: 300px;
  height: auto;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.link-group {
  margin-bottom: 1rem;
}

.link-group label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.link-group input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: monospace;
  font-size: 0.875rem;
  background: var(--surface);
}

.link-group input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.copy-btn {
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  margin-left: 0.5rem;
}

.login-section {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
}

.login-box {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
}

.login-box h2 {
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  text-align: center;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
}

.error-message {
  color: var(--danger-color);
  font-size: 0.875rem;
  text-align: center;
  margin-top: 1rem;
}

.admin-section {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}

.admin-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--border);
}

.admin-content {
  min-height: 400px;
}

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.panel-header h2 {
  font-size: 1.5rem;
  color: var(--text-primary);
}

.search-box input {
  padding: 0.5rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  width: 300px;
}

.images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.image-card {
  background: var(--background);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s;
}

.image-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.image-preview {
  width: 100%;
  height: 200px;
  object-fit: cover;
  cursor: pointer;
}

.image-info {
  padding: 1rem;
}

.image-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-meta {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.image-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.image-actions button {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.875rem;
}

.form-section {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.form-section:last-child {
  border-bottom: none;
}

.form-section h3 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.form-section h4 {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
  margin-top: 1rem;
}

.admin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

footer {
  text-align: center;
  padding: 2rem 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  header h1 {
    font-size: 1.5rem;
  }

  nav {
    width: 100%;
    justify-content: center;
  }

  .upload-area {
    padding: 2rem 1rem;
  }

  .upload-icon {
    font-size: 3rem;
  }

  .url-upload-area {
    flex-direction: column;
  }

  .panel-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .search-box input {
    width: 100%;
  }

  .images-grid {
    grid-template-columns: 1fr;
  }

  .admin-actions {
    flex-direction: column;
  }

  .admin-actions button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 1.25rem;
  }

  nav a {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }

  .upload-tabs {
    flex-wrap: wrap;
  }

  .tab-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }
}