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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

.app-container {
  min-height: 100vh;
  padding: 20px;
}

/* Header */
.header {
  text-align: center;
  color: white;
  margin-bottom: 40px;
}

.header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  font-weight: 300;
}

.header h1 i {
  margin-right: 15px;
  color: #ffd700;
}

.header p {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* Main Content */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
}

/* Upload Section */
.upload-section {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

/* Tabs */
.upload-tabs {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
  border-bottom: 1px solid #e0e0e0;
}

.tab-btn {
  background: none;
  border: none;
  padding: 15px 30px;
  font-size: 16px;
  cursor: pointer;
  color: #666;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  color: #667eea;
  background: #f8f9ff;
}

.tab-btn.active {
  color: #667eea;
  border-bottom-color: #667eea;
  background: #f8f9ff;
}

.tab-btn i {
  font-size: 18px;
}

/* Tab Panels */
.tab-panel {
  display: none;
}

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

/* Upload Area */
.upload-area {
  border: 3px dashed #d0d7ff;
  border-radius: 16px;
  padding: 60px 40px;
  text-align: center;
  background: #f8f9ff;
  transition: all 0.3s ease;
  cursor: pointer;
}

.upload-area:hover {
  border-color: #667eea;
  background: #f0f3ff;
}

.upload-area.dragover {
  border-color: #667eea;
  background: #e8edff;
  transform: scale(1.02);
}

.upload-icon {
  font-size: 4rem;
  color: #667eea;
  margin-bottom: 20px;
}

.upload-area h3 {
  font-size: 1.8rem;
  margin-bottom: 10px;
  color: #333;
  font-weight: 400;
}

.upload-area p {
  font-size: 1.1rem;
  color: #666;
  margin-bottom: 20px;
}

.browse-link {
  color: #667eea;
  text-decoration: underline;
  cursor: pointer;
  font-weight: 500;
}

.browse-link:hover {
  color: #5a6fd8;
}

.file-types {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #e0e0e0;
}

.file-types small {
  color: #888;
}

/* Upload Options */
.upload-options {
  margin-top: 30px;
  padding: 25px;
  background: #f8f9ff;
  border-radius: 12px;
  border: 1px solid #e8edff;
}

.upload-options.hidden {
  display: none;
}

.upload-options h4 {
  margin-bottom: 20px;
  color: #333;
  font-size: 1.2rem;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.option-group {
  display: flex;
  flex-direction: column;
}

.option-group label {
  margin-bottom: 8px;
  font-weight: 500;
  color: #555;
}

.option-group input[type="text"],
.option-group input[type="url"] {
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.3s ease;
}

.option-group input[type="text"]:focus,
.option-group input[type="url"]:focus {
  outline: none;
  border-color: #667eea;
}

.option-group input[required] {
  border-color: #ffa726;
  background-color: #fff8f1;
}

.option-group input[required]:focus {
  border-color: #ff9800;
  box-shadow: 0 0 0 2px rgba(255, 152, 0, 0.2);
}

.option-group label[for="directory"],
.option-group label[for="urlDirectory"] {
  position: relative;
}

.option-group label[for="directory"]::after,
.option-group label[for="urlDirectory"]::after {
  content: " *";
  color: #ff5722;
  font-weight: bold;
}

.checkbox-group {
  justify-content: center;
  align-items: center;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  cursor: pointer;
  margin: 0;
}

.checkbox-group input[type="checkbox"] {
  margin-right: 8px;
  transform: scale(1.2);
}

/* URL Upload Form */
.url-upload-form h3 {
  text-align: center;
  margin-bottom: 25px;
  color: #333;
  font-size: 1.5rem;
  font-weight: 400;
}

.url-input-group {
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
}

.url-input-group input {
  flex: 1;
  padding: 15px 20px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 16px;
  transition: border-color 0.3s ease;
}

.url-input-group input:focus {
  outline: none;
  border-color: #667eea;
}

.url-options {
  padding: 20px;
  background: #f8f9ff;
  border-radius: 12px;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-danger {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-primary:hover {
  background: #5a6fd8;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
  background: #f0f0f0;
  color: #666;
  border: 2px solid #e0e0e0;
}

.btn-secondary:hover {
  background: #e8e8e8;
  border-color: #d0d0d0;
}

.btn-danger {
  background: #ff4757;
  color: white;
}

.btn-danger:hover {
  background: #ff3838;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 71, 87, 0.3);
}

/* Gallery */
.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.gallery-header h3 {
  font-size: 1.5rem;
  color: #333;
  font-weight: 400;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.gallery-placeholder {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  grid-column: 1 / -1;
}

.gallery-placeholder i {
  font-size: 3rem;
  margin-bottom: 15px;
  opacity: 0.5;
}

.gallery-item {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.gallery-item-info {
  padding: 15px;
}

.gallery-item-title {
  font-weight: 500;
  margin-bottom: 5px;
  color: #333;
  font-size: 14px;
}

.gallery-item-meta {
  font-size: 12px;
  color: #888;
}

/* Progress Section */
.upload-progress,
.results-section {
  background: white;
  border-radius: 16px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.upload-progress.hidden,
.results-section.hidden {
  display: none;
}

.upload-progress h4,
.results-section h4 {
  margin-bottom: 20px;
  color: #333;
  font-size: 1.3rem;
  font-weight: 400;
}

.progress-item,
.result-item {
  display: flex;
  align-items: center;
  padding: 15px;
  margin-bottom: 10px;
  background: #f8f9ff;
  border-radius: 10px;
  border-left: 4px solid #667eea;
}

.progress-item.error,
.result-item.error {
  border-left-color: #ff4757;
  background: #fff5f5;
}

.progress-item.success,
.result-item.success {
  border-left-color: #2ed573;
  background: #f0fff4;
}

.progress-icon {
  margin-right: 15px;
  font-size: 20px;
}

.progress-info {
  flex: 1;
}

.progress-filename {
  font-weight: 500;
  margin-bottom: 5px;
}

.progress-status {
  font-size: 14px;
  color: #666;
}

.progress-bar {
  width: 100px;
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
  margin-left: 15px;
}

.progress-fill {
  height: 100%;
  background: #667eea;
  transition: width 0.3s ease;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.toast {
  background: white;
  padding: 15px 20px;
  margin-bottom: 10px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-left: 4px solid #667eea;
  animation: slideIn 0.3s ease;
  max-width: 350px;
}

.toast.success {
  border-left-color: #2ed573;
}

.toast.error {
  border-left-color: #ff4757;
}

.toast.warning {
  border-left-color: #ffa726;
}

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

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 16px;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid #e0e0e0;
}

.modal-header h4 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 500;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.modal-close:hover {
  background: #f0f0f0;
  color: #666;
}

.modal-body {
  padding: 25px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-body img {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 20px;
}

.image-info {
  background: #f8f9ff;
  padding: 15px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  padding: 20px 25px;
  border-top: 1px solid #e0e0e0;
  background: #f8f9fa;
}

/* Responsive Design */
@media (max-width: 768px) {
  .app-container {
    padding: 15px;
  }

  .header h1 {
    font-size: 2rem;
  }

  .upload-section {
    padding: 20px;
  }

  .upload-tabs {
    flex-direction: column;
    gap: 10px;
  }

  .tab-btn {
    justify-content: center;
    padding: 12px 20px;
  }

  .upload-area {
    padding: 40px 20px;
  }

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

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

  .url-input-group {
    flex-direction: column;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .modal-content {
    margin: 20px;
    max-width: calc(100% - 40px);
  }
}
