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

:root {
  --primary-color: #0366d6;
  --primary-hover: #0256c2;
  --secondary-color: #6a737d;
  --success-color: #28a745;
  --error-color: #dc3545;
  --warning-color: #ffc107;
  --bg-color: #f6f8fa;
  --card-bg: #ffffff;
  --border-color: #e1e4e8;
  --text-color: #24292e;
  --text-muted: #6a737d;
}

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

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border-color);
  flex-wrap: wrap;
  gap: 15px;
}

.main-nav {
  display: flex;
  gap: 8px;
}

.nav-btn {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.nav-btn:hover {
  color: var(--text-color);
  border-color: var(--primary-color);
}

.nav-btn.active {
  color: var(--primary-color);
  border-color: var(--primary-color);
  background: rgba(3, 102, 214, 0.1);
}

.main-view {
  display: block;
}

.main-view.hidden {
  display: none;
}

h1 {
  font-size: 28px;
  font-weight: 600;
}

.auth-section {
  display: flex;
  align-items: center;
  gap: 15px;
}

#user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-full-width {
  width: 100%;
}

.card-half {
  flex: 1;
  min-width: 0; /* Prevents flex items from overflowing */
}

.card h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* Two Column Layout */
.two-column-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

/* Useful Links Grid */
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border-color);
}

.tab-btn {
  padding: 12px 24px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s ease;
  margin-bottom: -2px;
}

.tab-btn:hover {
  color: var(--text-color);
}

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

.tab-content {
  display: none;
}

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

/* Admin Panel Styles */
.admin-section {
  margin-top: 20px;
}

.status-display {
  background: #f7fafc;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.status-label {
  color: #718096;
  font-weight: 500;
}

.status-value {
  font-weight: 600;
  color: #2d3748;
}

.status-value.enabled {
  color: #38a169;
}

.status-value.disabled {
  color: #e53e3e;
}

.toggle-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: #f7fafc;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.toggle-label {
  font-weight: 500;
  color: #2d3748;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 60px;
  height: 30px;
  display: inline-block;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e0;
  transition: 0.3s;
  border-radius: 30px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: #667eea;
}

input:checked + .toggle-slider:before {
  transform: translateX(30px);
}

.toggle-switch:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.link-item {
  padding: 16px;
  background: var(--bg-color);
  border-radius: 6px;
  border: none;
  transition: all 0.2s ease;
}

.link-item:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.link-title {
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-color);
}

.link-url {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 14px;
  display: block;
  margin-bottom: 0px;
  word-break: break-all;
}

.link-url:hover {
  text-decoration: underline;
}

.link-description {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.help-text {
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: 14px;
}

.help-text code {
  background: var(--bg-color);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 13px;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.message {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  display: none;
}

.message.show {
  display: block;
}

.message.success {
  background: #c6f6d5;
  color: #22543d;
}

.message.error {
  background: #fed7d7;
  color: #c53030;
}

.message.info {
  background: #bee3f8;
  color: #2c5282;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-color);
  font-size: 14px;
}

.form-select {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-color);
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.form-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.1);
}

.form-select:invalid {
  border-color: var(--error-color);
}

.form-help {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: 6px;
  padding: 40px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  background: var(--bg-color);
}

.drop-zone:hover {
  border-color: var(--primary-color);
  background: #f0f4f8;
}

.drop-zone.drag-over {
  border-color: var(--primary-color);
  background: #e8f4fd;
  transform: scale(1.02);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.upload-icon {
  color: var(--primary-color);
  margin-bottom: 8px;
}

.drop-zone-text {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-color);
}

.drop-zone-subtext {
  font-size: 14px;
  color: var(--text-muted);
}

.btn {
  display: inline-block;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  font-family: inherit;
}

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

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: var(--card-bg);
  color: var(--text-color);
  border-color: var(--border-color);
}

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

.btn-large {
  padding: 12px 24px;
  font-size: 16px;
  width: 100%;
  margin-top: 20px;
}

.btn-small {
  padding: 4px 8px;
  font-size: 12px;
}

.file-info {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg-color);
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.file-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#file-name {
  font-weight: 500;
  flex: 1;
}

#file-size {
  color: var(--text-muted);
  font-size: 14px;
}

.upload-progress {
  margin-top: 20px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-color);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--primary-color);
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
}

.status-message {
  margin-top: 20px;
  padding: 16px;
  border-radius: 6px;
  border: 1px solid;
}

.status-message.success {
  background: #d4edda;
  border-color: var(--success-color);
  color: #155724;
}

.status-message.error {
  background: #f8d7da;
  border-color: var(--error-color);
  color: #721c24;
}

.status-message.info {
  background: #d1ecf1;
  border-color: #17a2b8;
  color: #0c5460;
}

.upload-history {
  min-height: 100px;
}

.upload-item {
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-bottom: 12px;
  background: var(--bg-color);
}

.upload-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.upload-item-name {
  font-weight: 500;
}

.upload-item-status {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 3px;
  font-weight: 500;
}

.upload-item-status.completed {
  background: #d4edda;
  color: #155724;
}

.upload-item-status.processing {
  background: #fff3cd;
  color: #856404;
}

.upload-item-status.failed {
  background: #f8d7da;
  color: #721c24;
}

.upload-item-details {
  font-size: 14px;
  color: var(--text-muted);
}

.upload-item-link {
  color: var(--primary-color);
  text-decoration: none;
  margin-left: 8px;
}

.upload-item-link:hover {
  text-decoration: underline;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
  font-style: italic;
}

/* My Prototypes Section */
.prototypes-list {
  min-height: 100px;
}

.prototype-item {
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-bottom: 12px;
  background: var(--bg-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.prototype-item:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.prototype-info {
  flex: 1;
}

.prototype-name {
  font-weight: 500;
  font-size: 16px;
  margin-bottom: 4px;
  color: var(--text-color);
}

.prototype-meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  gap: 16px;
  align-items: center;
}

.prototype-date {
  display: flex;
  align-items: center;
  gap: 4px;
}

.prototype-path {
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  background: var(--card-bg);
  padding: 2px 6px;
  border-radius: 3px;
}

.prototype-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.prototype-link {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 13px;
}

.prototype-link:hover {
  text-decoration: underline;
}

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

.btn-danger:hover:not(:disabled) {
  background-color: #c82333;
  border-color: #bd2130;
}

.btn-danger:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Modal/Confirmation Dialog */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  font-size: 1.5rem;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 1rem;
}

.modal-body {
  margin-bottom: 1.5rem;
}

.modal h3 {
  margin-bottom: 12px;
  font-size: 18px;
}

.modal p {
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
}

.generated-password {
  background: #f0f4ff;
  border: 2px solid #667eea;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  text-align: center;
}

.generated-password-label {
  font-size: 0.85rem;
  color: #718096;
  margin-bottom: 0.5rem;
  display: block;
}

.generated-password-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: #2d3748;
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
  word-break: break-all;
}

.copy-password-btn {
  background: #667eea;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background 0.2s;
}

.copy-password-btn:hover {
  background: #5568d3;
}

.copy-password-btn:active {
  background: #4a5bc4;
}

.custom-password-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.custom-password-label {
  font-size: 0.9rem;
  color: #4a5568;
  margin-bottom: 0.75rem;
  display: block;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

.loading {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden {
  display: none !important;
}

footer {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 40px;
  border-top: 1px solid var(--border-color);
}

/* Copy button feedback */
.btn.copied {
  background: #10b981 !important;
  color: white !important;
  border-color: #10b981 !important;
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .container {
    padding: 15px;
  }

  .card {
    padding: 16px;
  }

  .drop-zone {
    padding: 30px 20px;
  }

  .two-column-layout {
    flex-direction: column;
  }

  .card-half {
    width: 100%;
  }

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

