* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.page {
  display: none;
  width: 100%;
  min-height: 100vh;
}

.page.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-container {
  background: white;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.login-container h1 {
  margin-bottom: 10px;
  color: #333;
}

.subtitle {
  color: #666;
  margin-bottom: 30px;
}

.login-container input[type="password"] {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s;
  margin-bottom: 20px;
}

.login-container input[type="password"]:focus {
  outline: none;
  border-color: #667eea;
}

.login-container button {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.login-container button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.error {
  color: #e74c3c;
  margin-top: 15px;
  font-size: 14px;
}

.upload-container {
  background: white;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  max-width: 650px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

#upload-page {
  align-items: flex-start;
  padding-top: 40px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eee;
}

header h1 {
  color: #333;
  font-size: 24px;
}

.btn-secondary {
  padding: 8px 16px;
  background: #f0f0f0;
  color: #666;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #e0e0e0;
}

.options-bar {
  margin-bottom: 20px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: #495057;
  user-select: none;
  margin-bottom: 12px;
}

.checkbox-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #ced4da;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked {
  background: #667eea;
  border-color: #667eea;
}

.checkbox-label input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.domain-config {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #dee2e6;
}

.domain-config label {
  display: block;
  font-size: 13px;
  color: #495057;
  margin-bottom: 8px;
  font-weight: 500;
}

.domain-config textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
}

.domain-config textarea:focus {
  outline: none;
  border-color: #667eea;
}

.hint-text {
  font-size: 11px !important;
  color: #adb5bd !important;
  margin-top: 6px !important;
}

.upload-area {
  border: 3px dashed #d0d0d0;
  border-radius: 12px;
  padding: 50px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: #fafafa;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: #667eea;
  background: #f0f4ff;
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 15px;
}

.upload-area p {
  color: #666;
  margin-bottom: 8px;
}

.hint {
  font-size: 13px !important;
  color: #999 !important;
}

.result-area {
  margin-top: 25px;
  padding: 20px;
  background: #f0fff4;
  border: 1px solid #c6f6d5;
  border-radius: 8px;
}

.result-area h3 {
  color: #22543d;
  margin-bottom: 15px;
}

.url-box {
  display: flex;
  gap: 10px;
}

.url-box input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  background: white;
}

.btn-primary {
  padding: 10px 20px;
  background: #48bb78;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-primary:hover {
  background: #38a169;
}

#file-info {
  margin-top: 10px;
  font-size: 13px;
  color: #666;
}

.protection-badge {
  margin-top: 12px;
  padding: 8px 14px;
  background: #e8f4fd;
  color: #1976d2;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  display: inline-block;
}

.hidden {
  display: none !important;
}

.history-list {
  margin-top: 30px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 16px;
  background: #f9f9f9;
  border-radius: 8px;
  margin-bottom: 10px;
  gap: 12px;
  flex-wrap: wrap;
}

.history-item .file-info-col {
  flex: 1;
  min-width: 150px;
}

.history-item .filename {
  font-weight: 500;
  color: #333;
  word-break: break-all;
}

.history-item .file-meta {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}

.history-item .domain-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.domain-tag {
  font-size: 11px;
  padding: 2px 8px;
  background: #e3f2fd;
  color: #1565c0;
  border-radius: 10px;
  font-weight: 500;
}

.history-item .actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.file-url-link {
  font-size: 13px;
  color: #667eea;
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}

.file-url-link:hover {
  text-decoration: underline;
}

.btn-protect,
.btn-domains,
.btn-delete {
  padding: 5px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-protect {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
}

.btn-protect:hover {
  background: #ffc107;
  color: white;
}

.btn-domains {
  background: #cce5ff;
  color: #004085;
  border: 1px solid #b8daff;
}

.btn-domains:hover {
  background: #004085;
  color: white;
}

.btn-delete {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.btn-delete:hover {
  background: #dc3545;
  color: white;
  border-color: #dc3545;
}

.protected-tag {
  font-size: 11px;
  padding: 3px 8px;
  background: #d4edda;
  color: #155724;
  border-radius: 4px;
  font-weight: 500;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  background: white;
  padding: 24px;
  border-radius: 12px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.modal-box h3 {
  margin-bottom: 16px;
  color: #333;
}

.modal-box textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  margin-bottom: 16px;
}

.modal-box textarea:focus {
  outline: none;
  border-color: #667eea;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal-actions button {
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  border: none;
  transition: all 0.2s;
}

.btn-cancel {
  background: #f0f0f0;
  color: #666;
}

.btn-cancel:hover {
  background: #e0e0e0;
}

.btn-save {
  background: #667eea;
  color: white;
}

.btn-save:hover {
  background: #5a6fd6;
}

.confirm-modal-box {
  max-width: 480px;
}

.confirm-file-info {
  background: #f8f9fa;
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.confirm-file-info p {
  margin: 6px 0;
  font-size: 14px;
  color: #495057;
}

.confirm-file-info p:first-child {
  margin-top: 0;
}

.confirm-file-info p:last-child {
  margin-bottom: 0;
}

.confirm-options {
  margin-bottom: 16px;
}

.direct-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.direct-url-label {
  font-size: 12px;
  color: #666;
  white-space: nowrap;
}

.direct-url-input {
  flex: 1;
  min-width: 150px;
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
  background: #fff;
  color: #333;
}

.direct-url-input:focus {
  outline: none;
  border-color: #667eea;
}

.btn-copy-direct {
  padding: 5px 12px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-copy-direct:hover {
  background: #5a6fd6;
}

.btn-copy-direct.copied {
  background: #48bb78;
}
