/* Modern glassmorphism design */
:root{
  --bg-start: #0a0e27;
  --bg-end: #0f1419;
  --glass: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text: #f0f4f8;
  --text-muted: #94a3b8;
  --accent: #00d9ff;
  --accent-glow: rgba(0, 217, 255, 0.4);
  --secondary: #a855f7;
  --secondary-glow: rgba(168, 85, 247, 0.4);
  --danger: #ff3864;
  --success: #00ffa3;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 8px 32px rgba(0, 217, 255, 0.2);
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
}

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

html, body { 
  height: 100%;
  overflow-x: hidden;
}

body{
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-end) 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  position: relative;
}

/* Animated background gradients */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: 
    radial-gradient(circle at 20% 50%, var(--accent-glow) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, var(--secondary-glow) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, rgba(0, 255, 163, 0.15) 0%, transparent 50%);
  animation: backgroundShift 20s ease infinite alternate;
  z-index: 0;
  pointer-events: none;
}

@keyframes backgroundShift {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-5%, -5%) rotate(2deg); }
}

.header{
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 24px 20px 20px;
  background: rgba(15, 20, 25, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md);
}

.title h1{
  margin: 0 0 8px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: titleShimmer 3s ease infinite alternate;
}

@keyframes titleShimmer {
  0% { filter: hue-rotate(0deg) brightness(1); }
  100% { filter: hue-rotate(10deg) brightness(1.2); }
}

.subtitle{
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}

.controls{
  margin-top: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.search{
  height: 56px;
  padding: 0 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search:focus{
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-md);
  transform: translateY(-2px);
}

.search::placeholder{ 
  color: var(--text-muted);
  font-weight: 400;
}

.btn{
  height: 56px;
  padding: 0 28px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn:hover{
  border-color: var(--danger);
  background: rgba(255, 56, 100, 0.1);
  box-shadow: 0 0 20px var(--danger), var(--shadow-md);
  transform: translateY(-2px);
}

.btn:active{ 
  transform: translateY(0px) scale(0.98);
}

.btn-secondary{
  background: rgba(255, 56, 100, 0.15);
}


.main{
  padding: 24px 20px;
  position: relative;
  z-index: 1;
}

.grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  animation: fadeIn 0.6s ease;
}

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

@media (max-width: 640px){
  .grid{ 
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
  }
  .main{
    padding: 20px 16px;
  }
}

.card{
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.08) 0%, 
    rgba(255, 255, 255, 0.04) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  animation: cardSlideIn 0.6s ease backwards;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--secondary), var(--success));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover::before {
  opacity: 1;
}

.card:hover{
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: rgba(0, 217, 255, 0.3);
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.12) 0%, 
    rgba(255, 255, 255, 0.06) 100%);
}

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

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.3s; }

.card .label{
  font-size: 18px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
  position: relative;
  z-index: 1;
}

.card .row{
  display: flex;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.play{
  flex: 1;
  height: 52px;
  border-radius: var(--radius-md);
  border: 2px solid var(--success);
  background: linear-gradient(135deg, 
    rgba(0, 255, 163, 0.2), 
    rgba(0, 217, 255, 0.15));
  color: var(--text);
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0, 255, 163, 0.2);
  position: relative;
  overflow: hidden;
}

.play::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.5s, height 0.5s;
}

.play:hover::before {
  width: 200px;
  height: 200px;
}

.play:hover{
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 255, 163, 0.4);
  border-color: var(--success);
}

.play:active{
  transform: scale(0.95);
}

.play.playing{
  border-color: var(--danger);
  background: linear-gradient(135deg, 
    rgba(255, 56, 100, 0.3), 
    rgba(168, 85, 247, 0.2));
  box-shadow: 0 4px 16px rgba(255, 56, 100, 0.4);
  animation: pulse 1.5s ease infinite;
}

@keyframes pulse {
  0%, 100% { 
    box-shadow: 0 4px 16px rgba(255, 56, 100, 0.4);
  }
  50% { 
    box-shadow: 0 8px 32px rgba(255, 56, 100, 0.6);
  }
}

.share{
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.share:hover{
  background: rgba(168, 85, 247, 0.2);
  border-color: var(--secondary);
  box-shadow: 0 8px 24px var(--secondary-glow);
  transform: scale(1.1) rotate(5deg);
}

.share:active{
  transform: scale(0.95) rotate(0deg);
}

.delete{
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 56, 100, 0.3);
  background: rgba(255, 56, 100, 0.1);
  backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.delete:hover{
  background: rgba(255, 56, 100, 0.25);
  border-color: var(--danger);
  box-shadow: 0 8px 24px rgba(255, 56, 100, 0.5);
  transform: scale(1.1) rotate(-5deg);
}

.delete:active{
  transform: scale(0.95) rotate(0deg);
}

.progress{
  height: 8px;
  width: 100%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.progress::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to bottom, 
    rgba(255, 255, 255, 0.1), 
    transparent);
  border-radius: 999px 999px 0 0;
}

.progress > div{
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, 
    var(--success), 
    var(--accent), 
    var(--secondary));
  background-size: 200% 100%;
  animation: progressGradient 2s ease infinite;
  border-radius: 999px;
  box-shadow: 0 0 10px var(--accent-glow);
  transition: width 0.1s linear;
  position: relative;
}

@keyframes progressGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.footer{
  padding: 24px 20px;
  color: var(--text-muted);
  border-top: 1px solid var(--glass-border);
  background: rgba(15, 20, 25, 0.5);
  backdrop-filter: blur(10px);
  text-align: center;
  position: relative;
  z-index: 1;
}

.footer small {
  font-size: 13px;
  line-height: 1.6;
}

code{
  background: rgba(0, 217, 255, 0.1);
  color: var(--accent);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-family: 'Courier New', monospace;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(0, 217, 255, 0.2);
}

.pill{
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  font-weight: 600;
  color: var(--text);
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent), var(--secondary));
  border-radius: 6px;
  border: 2px solid var(--bg-start);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--secondary), var(--success));
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Selection styling */
::selection {
  background: var(--accent-glow);
  color: var(--text);
}

::-moz-selection {
  background: var(--accent-glow);
  color: var(--text);
}

/* Mobile optimizations */
@media (max-width: 640px) {
  .header {
    padding: 20px 16px 16px;
  }
  
  .title h1 {
    font-size: 28px;
  }
  
  .subtitle {
    font-size: 13px;
  }
  
  .controls {
    flex-direction: column;
    gap: 10px;
  }
  
  .search, .btn {
    width: 100%;
    height: 52px;
  }
  
  .card {
    padding: 16px;
    gap: 14px;
  }
  
  .card .label {
    font-size: 16px;
  }
  
  .play, .share {
    height: 48px;
  }
  
  .share {
    width: 48px;
  }
  
  .footer {
    padding: 20px 16px;
  }
}

/* Loading animation for empty state */
.grid:empty::after {
  content: 'Cargando...';
  display: block;
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 16px;
  animation: fadeIn 0.5s ease;
}

/* Focus visible for accessibility */
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Button variants */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--secondary));
  border-color: var(--accent);
  font-weight: 800;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--secondary), var(--success));
  box-shadow: 0 0 30px var(--accent-glow), var(--shadow-lg);
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 500px;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.1) 0%, 
    rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  animation: modalSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

.modal-header h2 {
  font-size: 24px;
  font-weight: 800;
  margin: 0;
  background: linear-gradient(135deg, var(--accent), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: rgba(255, 56, 100, 0.2);
  border-color: var(--danger);
  transform: rotate(90deg);
}

/* Form styles */
.upload-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.3px;
}

.form-input {
  height: 52px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  outline: none;
  transition: all 0.3s ease;
}

.form-input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.file-input-wrapper {
  position: relative;
}

.file-input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
}

.file-input-display {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 2px dashed var(--glass-border);
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.3s ease;
  cursor: pointer;
  min-height: 72px;
}

.file-input:hover + .file-input-display,
.file-input:focus + .file-input-display {
  border-color: var(--accent);
  background: rgba(0, 217, 255, 0.05);
  box-shadow: 0 0 20px var(--accent-glow);
}

.file-icon {
  font-size: 32px;
  line-height: 1;
}

.file-name {
  flex: 1;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
}

.file-input-display.has-file .file-name {
  color: var(--text);
  font-weight: 600;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.form-actions .btn {
  justify-content: center;
}

.btn-cancel {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--glass-border);
}

.btn-cancel:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--text-muted);
}

.btn-submit {
  background: linear-gradient(135deg, var(--success), var(--accent));
  border-color: var(--success);
  font-weight: 800;
}

.btn-submit:hover {
  background: linear-gradient(135deg, var(--accent), var(--secondary));
  box-shadow: 0 0 30px var(--accent-glow), var(--shadow-lg);
  transform: translateY(-2px);
}

.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Mobile modal adjustments */
@media (max-width: 640px) {
  .modal {
    padding: 12px;
  }
  
  .modal-content {
    padding: 24px 20px;
    max-width: 100%;
  }
  
  .modal-header h2 {
    font-size: 20px;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .form-actions .btn {
    width: 100%;
  }
}
