/* Login overlay */
.login-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; z-index: 999;
}
.login-overlay.hidden { display: none; }
.login-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 40px 32px 32px; width: 100%; max-width: 380px; text-align: center;
}
.login-box h2 { margin-bottom: 8px; font-size: 22px; }
.login-box p { color: var(--text-dim); font-size: 13px; margin-bottom: 24px; }
.login-box .input-group { position: relative; margin-bottom: 16px; }
.login-box input {
  width: 100%; padding: 12px 16px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 15px; outline: none; transition: border-color 0.2s;
}
.login-box input:focus { border-color: var(--accent); }
.login-box .login-error { font-size: 13px; color: var(--red); margin-top: -8px; margin-bottom: 16px; display: none; }
.login-box .login-error.visible { display: block; }
.login-box .btn-primary { width: 100%; padding: 12px; }

/* Confirm overlay */
.confirm-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; z-index: 998;
}
.confirm-overlay.visible { display: flex; }
.confirm-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 28px; width: 100%; max-width: 380px; text-align: center;
}
.confirm-box h3 { margin-bottom: 8px; }
.confirm-box p { color: var(--text-dim); font-size: 13px; margin-bottom: 20px; }
.confirm-box .btns { display: flex; gap: 8px; justify-content: center; }
.confirm-box .btns button { min-width: 100px; }

/* Buttons */
.btn {
  padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer;
  font-size: 14px; font-weight: 600; transition: all 0.2s;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--text-dim); color: var(--text); }
.btn-danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
.btn-danger:hover { background: rgba(214, 48, 49, 0.1); }

/* Upload zone */
.upload-zone {
  width: 100%; border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 32px 24px; text-align: center; cursor: pointer;
  transition: all 0.2s; background: var(--surface); position: relative;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: rgba(108, 92, 231, 0.05); }
.upload-zone.dragover { transform: scale(1.01); box-shadow: 0 0 30px rgba(108, 92, 231, 0.15); }
.upload-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.7; }
.upload-text { font-size: 16px; color: var(--text-dim); margin-bottom: 6px; }
.upload-hint { font-size: 13px; color: var(--text-dim); opacity: 0.6; }
.upload-hint a { color: var(--accent); text-decoration: none; }
.upload-hint a:hover { text-decoration: underline; }
#fileInput, #folderInput { display: none; }

/* Preview */
.preview-section { width: 100%; margin-top: 20px; display: none; }
.preview-section.active { display: block; }
.preview-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.preview-header span { font-size: 14px; color: var(--text-dim); }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.preview-card {
  position: relative; border-radius: 8px; overflow: hidden;
  aspect-ratio: 1; background: var(--surface); border: 1px solid var(--border);
}
.preview-card img { width: 100%; height: 100%; object-fit: cover; }
.preview-card .file-icon {
  display: flex; align-items: center; justify-content: center;
  height: 100%; font-size: 10px; color: var(--text-dim); text-transform: uppercase;
}
.preview-card .remove-btn {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: rgba(0,0,0,0.7); color: white; border: none;
  cursor: pointer; font-size: 11px; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s;
}
.preview-card:hover .remove-btn { opacity: 1; }
.preview-card .name {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 3px 5px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8)); font-size: 9px; color: #ccc;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.preview-card .progress-overlay {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 17, 23, 0.85); display: flex; align-items: center;
  justify-content: center; flex-direction: column; gap: 6px; opacity: 0; transition: opacity 0.3s;
}
.preview-card .progress-overlay.active { opacity: 1; }
.progress-bar { width: 80%; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--accent); border-radius: 2px; width: 0%; transition: width 0.3s; }
.progress-bar-fill.done { background: var(--green); }
.progress-bar-fill.error { background: var(--red); }

/* Results */
.results-section { width: 100%; margin-top: 20px; display: none; }
.results-section.active { display: block; }
.result-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; margin-bottom: 6px; display: flex; gap: 10px; align-items: center;
}
.result-card.success { border-left: 3px solid var(--green); }
.result-card.error { border-left: 3px solid var(--red); }
.result-thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex-shrink: 0; background: var(--bg); }
.result-info { flex: 1; min-width: 0; }
.result-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-url { font-size: 12px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; margin-top: 2px; display: block; }
.result-error { font-size: 12px; color: var(--red); margin-top: 2px; }
.copy-btn {
  padding: 6px 12px; font-size: 12px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.copy-btn.copied { background: var(--green); color: white; border-color: var(--green); }
.copy-all-bar { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 10px; }
.upload-stats { text-align: center; font-size: 13px; color: var(--text-dim); margin-bottom: 8px; }

/* Gallery header */
.gallery-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.gallery-info { font-size: 14px; color: var(--text-dim); }
.gallery-header-right { display: flex; gap: 8px; }

/* Gallery folder sections */
.folder-section { margin-bottom: 28px; }
.folder-title {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border); font-size: 16px; font-weight: 600; color: var(--text);
}
.folder-title .folder-count { font-size: 12px; color: var(--text-dim); font-weight: 400; }
.folder-title .zip-btn {
  margin-left: auto; padding: 6px 12px; font-size: 12px; font-weight: 500; border-radius: 6px;
  border: 1px solid var(--accent); background: var(--accent); color: white; cursor: pointer; transition: opacity 0.2s;
}
.folder-title .zip-btn:hover { opacity: 0.85; }
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }

.gallery-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden; transition: border-color 0.2s;
}
.gallery-item:hover { border-color: var(--accent); }
.gallery-item .thumb-wrap { width: 100%; aspect-ratio: 1; overflow: hidden; background: var(--bg); cursor: pointer; }
.gallery-item .thumb-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.gallery-item:hover .thumb-wrap img { transform: scale(1.08); }
.gallery-item .info { padding: 6px 8px 8px; }
.gallery-item .filename { font-size: 10px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gallery-item .size-date { font-size: 9px; color: var(--text-dim); opacity: 0.5; }
.gallery-item .actions { display: flex; gap: 4px; margin-top: 4px; }
.gallery-item .actions button {
  flex: 1; padding: 4px 0; font-size: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text-dim); border-radius: 4px; cursor: pointer; transition: all 0.2s;
}
.gallery-item .actions button:hover { border-color: var(--accent); color: var(--accent); }
.gallery-item .actions button.copied { background: var(--green); color: white; border-color: var(--green); }
.gallery-item .actions .del-btn { color: var(--red); border-color: transparent; }
.gallery-item .actions .del-btn:hover { border-color: var(--red); background: rgba(214,48,49,0.08); }

.gallery-status { text-align: center; padding: 48px 20px; color: var(--text-dim); font-size: 14px; }
.gallery-status .big-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }

@media (max-width: 480px) {
  body { padding: 20px 12px 60px; }
  .upload-zone { padding: 24px 16px; }
  .preview-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
  .folder-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
}
