/* ===========================================
   Space Upload Zone & File Management Styles
   =========================================== */

/* CSS Variables */
:root {
  --primary: #00ff88;
  --secondary: #00e5ff;
  --surface: #12121a;
  --text-primary: #ffffff;
  --text-secondary: #8b8b9a;
  --accent: #a855f7;
  --warning: #ff6b35;
}

/* ===========================================
   1. Upload Zone Styles
   =========================================== */

.space-upload-zone {
  border: 2px dashed var(--text-secondary, #8b8b9a);
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  padding: 40px 20px;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.space-upload-zone:hover {
  border-color: var(--primary, #00ff88);
  background-color: rgba(0, 255, 136, 0.05);
}

.space-upload-zone.dragover {
  border-color: var(--primary, #00ff88);
  background-color: rgba(0, 255, 136, 0.1);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
  transform: scale(1.02);
}

.space-upload-zone.uploading {
  opacity: 0.6;
  pointer-events: none;
}

.space-upload-icon {
  font-size: 48px;
  display: block;
  text-align: center;
  margin-bottom: 12px;
}

.space-upload-text {
  font-size: 18px;
  color: var(--text-primary, #ffffff);
  margin-bottom: 8px;
}

.space-upload-hint {
  font-size: 14px;
  color: var(--text-secondary, #8b8b9a);
  margin-bottom: 4px;
}

.space-upload-types {
  font-size: 12px;
  color: var(--text-secondary, #8b8b9a);
  opacity: 0.7;
}

.space-progress {
  display: none;
  width: 100%;
  height: 8px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  margin-top: 16px;
  overflow: hidden;
}

.space-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary, #00ff88), var(--secondary, #00e5ff));
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* ===========================================
   2. File List Styles
   =========================================== */

.space-file-list {
  margin: 20px 0;
}

.space-file-card {
  display: flex;
  align-items: center;
  padding: 16px;
  background-color: var(--surface, #12121a);
  border-radius: 8px;
  margin-bottom: 12px;
  gap: 12px;
}

.space-file-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.space-file-info {
  flex: 1;
  min-width: 0;
}

.space-file-name {
  display: block;
  color: var(--text-primary, #ffffff);
  text-decoration: none;
  word-break: break-word;
  transition: color 0.2s ease;
}

.space-file-name:hover {
  color: var(--primary, #00ff88);
}

.space-file-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.space-file-badge.public {
  background-color: rgba(0, 255, 136, 0.15);
  color: var(--primary, #00ff88);
}

.space-file-badge.private {
  background-color: rgba(139, 139, 154, 0.15);
  color: var(--text-secondary, #8b8b9a);
}

.space-file-actions {
  display: flex;
  flex-direction: row;
  gap: 8px;
  flex-shrink: 0;
}

.space-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.1s ease;
}

.space-btn:hover {
  opacity: 0.85;
}

.space-btn:active {
  transform: scale(0.97);
}

.space-btn.study {
  background: linear-gradient(135deg, var(--primary, #00ff88), var(--secondary, #00e5ff));
  color: #000;
}

.space-btn.delete {
  background-color: var(--warning, #ff6b35);
  color: var(--text-primary, #ffffff);
}

.space-btn.toggle {
  background-color: var(--accent, #a855f7);
  color: var(--text-primary, #ffffff);
}

/* ===========================================
   3. Study Modal Styles
   =========================================== */

.space-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.space-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.space-modal {
  background-color: var(--surface, #12121a);
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.space-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.space-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.space-study-content {
  background-color: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  padding: 16px;
  max-height: 200px;
  overflow-y: auto;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary, #ffffff);
}

.space-study-result {
  background-color: rgba(0, 229, 255, 0.1);
  border-left: 3px solid var(--secondary, #00e5ff);
  padding: 12px 16px;
  margin-top: 16px;
  border-radius: 0 8px 8px 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.space-study-loading {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary, #8b8b9a);
}

.space-study-loading::after {
  content: '';
  animation: dot-animation 1.5s infinite;
}

.space-study-error {
  background-color: rgba(255, 107, 53, 0.1);
  border-left: 3px solid #ff6b35;
  padding: 12px 16px;
  margin-top: 16px;
  border-radius: 0 8px 8px 0;
  color: var(--text-primary, #ffffff);
}

.space-btn.retry {
  background-color: var(--warning, #ff6b35);
  color: var(--text-primary, #ffffff);
}

/* ===========================================
   6. Upload Zone Error State
   =========================================== */

.space-upload-zone.error {
  border-color: #ff6b35;
  background-color: rgba(255, 107, 53, 0.1);
}

/* ===========================================
   7. File Card Hover State
   =========================================== */

.space-file-card:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* ===========================================
   8. Modal Close Button
   =========================================== */

.space-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary, #8b8b9a);
  cursor: pointer;
  transition: color 0.2s ease;
}

.space-modal-close:hover {
  color: var(--text-primary, #ffffff);
}

/* ===========================================
   9. Toast Notifications
   =========================================== */

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  color: var(--text-primary, #ffffff);
  font-size: 14px;
  z-index: 2000;
  animation: toast-in 0.3s ease forwards;
}

.toast-success {
  background-color: var(--primary, #00ff88);
  color: #000;
}

.toast-error {
  background-color: #ff6b35;
  color: var(--text-primary, #ffffff);
}

.toast-info {
  background-color: var(--secondary, #00e5ff);
  color: #000;
}

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