/* styles.css - Versión mejorada */
:root {
  --primary-color: #000000;
  --secondary-color: #333333;
  --accent-color: #666666;
  --bg-color: #ffffff;
  --text-color: #000000;
  --card-bg: #f5f5f5;
  --border-color: #e0e0e0;
  --success-color: #4CAF50;
  --warning-color: #ff9800;
  --error-color: #f44336;
  --border-radius: 8px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  --transition: all 0.3s ease;
}

[data-theme="dark"] {
  --primary-color: #ffffff;
  --secondary-color: #cccccc;
  --accent-color: #999999;
  --bg-color: #121212;
  --text-color: #ffffff;
  --card-bg: #1e1e1e;
  --border-color: #333333;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

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

body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  transition: var(--transition);
}

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

header {
  text-align: center;
  margin-bottom: 30px;
  position: relative;
}

.logo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 15px;
}

.logo-shape {
  width: 80px;
  height: 80px;
  background: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
  position: relative;
  overflow: hidden;
  animation: pulse 3s infinite;
}

.logo-shape::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, transparent 40%, rgba(255,255,255,0.2) 50%, transparent 60%);
  animation: shine 4s infinite;
}

@keyframes shine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.logo-inner {
  color: var(--bg-color);
  font-weight: bold;
  font-size: 1.5rem;
}

.logo-text {
  font-size: 2.5rem;
  font-weight: bold;
  letter-spacing: 4px;
  margin: 0;
}

.tagline {
  color: var(--secondary-color);
  font-size: 1.1rem;
  margin-bottom: 20px;
}

.theme-toggle {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: 2px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.theme-toggle:hover {
  transform: rotate(30deg);
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.scan-section, .file-info, .history-section {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.buttons {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  justify-content: center;
}

.btn-primary, .btn-secondary, .btn-reconstruct, .btn-clear {
  padding: 12px 24px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
}

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

.btn-secondary {
  background: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
}

.btn-reconstruct {
  background: var(--primary-color);
  color: var(--bg-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.btn-clear {
  background: transparent;
  color: var(--error-color);
  border: 1px solid var(--error-color);
  padding: 6px 12px;
  font-size: 0.9rem;
}

.btn-primary:hover:not(:disabled), .btn-reconstruct:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-2px);
}

.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.05);
}

.btn-clear:hover {
  background: rgba(244, 67, 54, 0.1);
}

#file-input {
  display: none;
}

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

.progress-container.enhanced {
  background: var(--card-bg);
  padding: 15px;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.progress-header h3 {
  font-size: 1.1rem;
  color: var(--secondary-color);
}

.progress-bar {
  height: 12px;
  background: var(--border-color);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary-color);
  border-radius: 10px;
  width: 0%;
  transition: width 0.5s ease;
}

.progress-details {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--secondary-color);
  text-align: center;
}

.progress-stats {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--secondary-color);
}

.block-status {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.block-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-color);
  display: inline-block;
}

.block-indicator.received {
  background: var(--success-color);
}

.block-indicator.missing {
  background: var(--error-color);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.info-item {
  display: flex;
  flex-direction: column;
}

.info-item label {
  font-weight: bold;
  font-size: 0.9rem;
  color: var(--secondary-color);
  margin-bottom: 5px;
}

.file-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.file-info-item {
  display: flex;
  flex-direction: column;
  padding: 10px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: var(--border-radius);
}

.file-info-label {
  font-weight: bold;
  font-size: 0.9rem;
  color: var(--secondary-color);
  margin-bottom: 5px;
}

.file-info-value {
  font-size: 1rem;
  word-break: break-all;
}

.hash-value {
  font-family: monospace;
  font-size: 0.85rem;
  word-break: break-all;
}

.hash-display {
  font-family: monospace;
  font-size: 0.8rem;
  background: var(--bg-color);
  padding: 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  max-height: 100px;
  overflow-y: auto;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  background: rgba(0, 0, 0, 0.05);
  padding: 15px;
  border-radius: var(--border-radius);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-color);
  animation: fadeIn 0.5s ease;
  transition: var(--transition);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.history-info {
  flex: 1;
}

.history-name {
  font-weight: bold;
  margin-bottom: 5px;
}

.history-details {
  font-size: 0.85rem;
  color: var(--secondary-color);
}

.download-btn {
  background: transparent;
  border: 1px solid var(--success-color);
  color: var(--success-color);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: var(--transition);
}

.download-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.camera-container {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.scan-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 3px solid transparent;
  border-radius: 8px;
  pointer-events: none;
  transition: all 0.3s ease;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
}

.scan-overlay.active {
  border-color: var(--success-color);
  animation: pulse-border 0.5s ease;
}

.scan-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70%;
  height: 70%;
  border: 2px dashed rgba(255, 255, 255, 0.6);
  border-radius: 8px;
  pointer-events: none;
}

@keyframes pulse-border {
  0% { border-color: transparent; }
  50% { border-color: var(--success-color); }
  100% { border-color: transparent; }
}

.scan-success {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--success-color);
  color: white;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  display: none;
  animation: fadeInOut 1s ease;
}

@keyframes fadeInOut {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

.scan-statistics {
  display: flex;
  justify-content: space-around;
  margin-top: 15px;
  padding: 10px;
  background: var(--card-bg);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-weight: bold;
  font-size: 1.2rem;
  color: var(--primary-color);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--secondary-color);
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 25px;
  width: 90%;
  max-width: 600px;
  position: relative;
  text-align: center;
  max-height: 90vh;
  overflow-y: auto;
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--secondary-color);
  transition: var(--transition);
  background: none;
  border: none;
  z-index: 10;
}

.close-btn:hover {
  color: var(--primary-color);
}

.scan-help {
  margin-bottom: 20px;
  color: var(--secondary-color);
}

.modal video {
  width: 100%;
  border-radius: 8px;
  max-height: 60vh;
  border: 2px solid transparent;
  transition: border-color 0.3s ease;
}

.scan-status {
  margin-top: 15px;
  font-size: 0.9rem;
  min-height: 20px;
  color: var(--secondary-color);
}

#password-input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  margin-top: 15px;
  background: var(--bg-color);
  color: var(--text-color);
  transition: var(--transition);
}

#password-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

.modal-actions {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 20px;
  border-radius: var(--border-radius);
  color: white;
  z-index: 1001;
  max-width: 350px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
  transition: var(--transition);
}

.notification.success {
  background: var(--success-color);
}

.notification.error {
  background: var(--error-color);
}

.notification.info {
  background: var(--primary-color);
}

.notification.warning {
  background: var(--warning-color);
}

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

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.no-history {
  text-align: center;
  color: var(--secondary-color);
  font-style: italic;
  padding: 20px;
}

.loading {
  opacity: 0.7;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }
  
  .buttons {
    flex-direction: column;
  }
  
  .info-grid {
    grid-template-columns: 1fr;
  }
  
  .file-info-grid {
    grid-template-columns: 1fr;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .history-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .download-btn {
    align-self: flex-end;
  }
  
  .modal-buttons {
    flex-direction: column;
  }
  
  .notification {
    right: 10px;
    left: 10px;
    max-width: none;
  }
  
  .scan-statistics {
    flex-direction: column;
    gap: 10px;
  }
}
