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

body {
  font-family: 'Poppins', sans-serif;
  background: #0a0a0a;
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 20px;
  padding-top: 60px;
  overflow-x: hidden;
}

/* Three.js Canvas Background */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.6;
}

/* Container */
.container {
  width: 100%;
  max-width: 500px;
  position: relative;
  z-index: 1;
}

/* Statistics Bar */
.stats-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(20, 20, 20, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 204, 0, 0.3);
  border-radius: 15px;
  padding: 20px 25px;
  margin-bottom: 20px;
  animation: slideDown 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stat-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #ffcc00;
  text-shadow: 0 0 10px rgba(255, 204, 0, 0.3);
}

.history-toggle-btn {
  padding: 10px 20px;
  background: rgba(255, 204, 0, 0.1);
  border: 1px solid #ffcc00;
  border-radius: 10px;
  color: #ffcc00;
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Poppins', sans-serif;
}

.history-toggle-btn:hover {
  background: #ffcc00;
  color: #000;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 204, 0, 0.3);
}

/* Main Card */
.main-card {
  background: rgba(20, 20, 20, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid #ffcc00;
  border-radius: 20px;
  padding: 40px 30px;
  box-shadow: 0 0 40px rgba(255, 204, 0, 0.2);
  animation: cardEntry 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Brand (Logo + Title) */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 40px;
  animation: fadeIn 0.8s ease;
}

.logo {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid transparent;
  background: linear-gradient(#000, #000) padding-box,
              linear-gradient(135deg, #ffcc00 0%, #ffa500 50%, #ffcc00 100%) border-box;
  box-shadow: 
    0 0 40px rgba(255, 204, 0, 0.5),
    0 0 80px rgba(255, 204, 0, 0.3),
    0 10px 30px rgba(0, 0, 0, 0.5);
  filter: brightness(1.1) contrast(1.15);
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  animation: logoFloat 4s ease-in-out infinite;
  position: relative;
  display: block;
}

.logo::before {
  content: '';
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -6px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffcc00, #ffa500, #ffcc00);
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: -1;
  filter: blur(15px);
}

.logo:hover {
  transform: scale(1.12) rotate(8deg);
  box-shadow: 
    0 0 50px rgba(255, 204, 0, 0.7),
    0 0 100px rgba(255, 204, 0, 0.4),
    0 15px 40px rgba(0, 0, 0, 0.6);
  filter: brightness(1.2) contrast(1.2);
}

.logo:hover::before {
  opacity: 0.6;
}

@keyframes logoFloat {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  25% {
    transform: translateY(-8px) rotate(2deg);
  }
  50% {
    transform: translateY(-12px) rotate(0deg);
  }
  75% {
    transform: translateY(-8px) rotate(-2deg);
  }
}

/* Title */
.title {
  text-align: center;
  font-size: 2.4rem;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(135deg, #fff 0%, #ffcc00 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.5px;
  text-shadow: 0 0 30px rgba(255, 204, 0, 0.3);
}

/* Input Card */
.input-card {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.url-input {
  flex: 1;
  padding: 14px 18px;
  background: rgba(30, 30, 30, 0.6);
  border: 1px solid rgba(255, 204, 0, 0.3);
  border-radius: 12px;
  color: #fff;
  font-size: 0.9rem;
  font-family: 'Poppins', sans-serif;
  outline: none;
  transition: all 0.3s ease;
}

.url-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.url-input:focus {
  border-color: #ffcc00;
  background: rgba(30, 30, 30, 0.9);
  box-shadow: 0 0 20px rgba(255, 204, 0, 0.2);
}

.btn-download {
  padding: 14px 28px;
  background: linear-gradient(135deg, #ffcc00 0%, #ffa500 100%);
  border: none;
  border-radius: 12px;
  color: #000;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Poppins', sans-serif;
}

.btn-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 204, 0, 0.4);
}

.btn-download:active {
  transform: translateY(0);
}

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

/* Loading */
.loading {
  text-align: center;
  padding: 30px;
  animation: fadeIn 0.3s ease;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 204, 0, 0.2);
  border-top-color: #ffcc00;
  border-radius: 50%;
  margin: 0 auto 15px;
  animation: spin 0.8s linear infinite;
}

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

.loading p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
}

/* Result Card */
.result-card {
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.thumbnail {
  width: 100%;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.info {
  margin-bottom: 20px;
}

.video-title {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 8px;
  line-height: 1.4;
}

.author {
  color: #ffcc00;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
}

/* Quality Selector */
.quality-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px;
  background: rgba(30, 30, 30, 0.6);
  border: 1px solid rgba(255, 204, 0, 0.2);
  border-radius: 10px;
  margin-bottom: 15px;
  animation: slideUp 0.3s ease;
}

.quality-label {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

.quality-buttons {
  display: flex;
  gap: 8px;
}

.quality-btn {
  padding: 8px 20px;
  background: rgba(255, 204, 0, 0.1);
  border: 1px solid rgba(255, 204, 0, 0.3);
  border-radius: 8px;
  color: #ffcc00;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Poppins', sans-serif;
  min-width: 60px;
}

.quality-btn:hover {
  background: rgba(255, 204, 0, 0.2);
  border-color: #ffcc00;
  transform: translateY(-2px);
}

.quality-btn.active {
  background: linear-gradient(135deg, #ffcc00 0%, #ffa500 100%);
  border-color: #ffcc00;
  color: #000;
  box-shadow: 0 4px 15px rgba(255, 204, 0, 0.4);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.btn-action {
  flex: 1;
  padding: 12px;
  background: rgba(255, 204, 0, 0.1);
  border: 1px solid rgba(255, 204, 0, 0.3);
  border-radius: 10px;
  color: #ffcc00;
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Poppins', sans-serif;
}

.btn-action:hover {
  background: rgba(255, 204, 0, 0.2);
  border-color: #ffcc00;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 204, 0, 0.2);
}

.btn-download-video {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #ffcc00 0%, #ffa500 100%);
  border: none;
  border-radius: 12px;
  color: #000;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Poppins', sans-serif;
  margin-bottom: 15px;
}

.btn-download-video:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 204, 0, 0.5);
}

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

/* Download Progress */
.download-progress {
  animation: fadeIn 0.3s ease;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffcc00 0%, #ffa500 100%);
  border-radius: 10px;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(255, 204, 0, 0.5);
}

.progress-text {
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

/* Error */
.error-card {
  text-align: center;
  padding: 30px 20px;
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.error-icon {
  font-size: 3rem;
  margin-bottom: 15px;
}

.error-card p {
  color: #ff6b6b;
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.btn-retry {
  padding: 12px 24px;
  background: transparent;
  border: 1px solid #ffcc00;
  border-radius: 12px;
  color: #ffcc00;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Poppins', sans-serif;
}

.btn-retry:hover {
  background: #ffcc00;
  color: #000;
}

/* Professional Footer */
.footer {
  position: relative;
  z-index: 1;
  margin-top: 60px;
  padding: 40px 20px 20px;
  background: rgba(20, 20, 20, 0.85);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 204, 0, 0.3);
  animation: fadeIn 1s ease 0.5s backwards;
}

.footer-content {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

.footer-section h4 {
  color: #ffcc00;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 15px;
}

.footer-section p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  line-height: 1.6;
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  margin-bottom: 8px;
  padding-left: 15px;
  position: relative;
}

.footer-section ul li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: #ffcc00;
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 204, 0, 0.2);
}

.footer-bottom p {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.8rem;
}

/* Download History Section */
.history-section {
  background: rgba(20, 20, 20, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 204, 0, 0.3);
  border-radius: 15px;
  padding: 25px;
  margin-top: 20px;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 204, 0, 0.2);
}

.history-header h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: #fff;
}

.btn-clear-history {
  padding: 8px 16px;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 8px;
  color: #ff6b6b;
  font-weight: 500;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Poppins', sans-serif;
}

.btn-clear-history:hover {
  background: rgba(255, 107, 107, 0.2);
  border-color: #ff6b6b;
  transform: translateY(-2px);
}

.history-list {
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-list::-webkit-scrollbar {
  width: 8px;
}

.history-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb {
  background: rgba(255, 204, 0, 0.3);
  border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 204, 0, 0.5);
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: rgba(30, 30, 30, 0.6);
  border: 1px solid rgba(255, 204, 0, 0.2);
  border-radius: 10px;
  transition: all 0.3s ease;
}

.history-item:hover {
  background: rgba(30, 30, 30, 0.9);
  border-color: rgba(255, 204, 0, 0.4);
  transform: translateX(5px);
}

.history-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.history-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
  line-height: 1.4;
}

.history-time {
  font-size: 0.75rem;
  color: rgba(255, 204, 0, 0.7);
}

.history-redownload {
  padding: 8px 12px;
  background: rgba(255, 204, 0, 0.1);
  border: 1px solid rgba(255, 204, 0, 0.3);
  border-radius: 8px;
  color: #ffcc00;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Poppins', sans-serif;
}

.history-redownload:hover {
  background: #ffcc00;
  color: #000;
  transform: rotate(180deg);
}

.history-empty {
  text-align: center;
  padding: 40px 20px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.9rem;
}

/* Video Preview Modal */
.video-preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.video-preview-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
}

.video-preview-content {
  position: relative;
  width: 90%;
  max-width: 800px;
  z-index: 1001;
  animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.video-preview-close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 40px;
  height: 40px;
  background: #ffcc00;
  border: none;
  border-radius: 50%;
  color: #000;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.video-preview-close:hover {
  background: #ffa500;
  transform: rotate(90deg);
}

.video-player {
  width: 100%;
  max-height: 80vh;
  border-radius: 15px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Notification System */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 350px;
  background: rgba(20, 20, 20, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid #ffcc00;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 204, 0, 0.3);
  z-index: 2000;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
  transform: translateX(400px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.notification.show {
  transform: translateX(0);
  opacity: 1;
}

.notification-success {
  border-color: #4ade80;
}

.notification-error {
  border-color: #ff6b6b;
}

.notification-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.notification-title {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
}

.notification-message {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.4;
}

.notification-close {
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 300;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.notification-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* Utility */
.hidden {
  display: none !important;
}

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

/* Responsive */
@media (max-width: 768px) {
  .logo {
    width: 100px;
    height: 100px;
    border-width: 3px;
  }

  .title {
    font-size: 2rem;
  }
  
  .notification {
    width: 300px;
  }
  
  .action-buttons {
    flex-wrap: wrap;
  }
  
  .btn-action {
    flex: 1 1 calc(50% - 5px);
    min-width: 120px;
  }
}

@media (max-width: 600px) {
  .main-card {
    padding: 30px 20px;
  }

  .brand {
    gap: 18px;
    margin-bottom: 30px;
  }

  .logo {
    width: 90px;
    height: 90px;
    border-width: 3px;
  }

  .title {
    font-size: 1.8rem;
  }

  .input-card {
    flex-direction: column;
  }

  .btn-download {
    width: 100%;
  }
  
  .stats-bar {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
  
  .stat-item {
    width: 100%;
  }
  
  .history-toggle-btn {
    width: 100%;
  }
  
  .notification {
    width: calc(100% - 40px);
    left: 20px;
    right: 20px;
  }
  
  .video-preview-content {
    width: 95%;
  }
  
  .video-preview-close {
    top: -50px;
  }

  .footer {
    margin-top: 40px;
    padding: 30px 20px 15px;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 25px;
  }

  .footer-bottom p {
    font-size: 0.75rem;
  }
}

@media (max-width: 400px) {
  .logo {
    width: 80px;
    height: 80px;
  }

  .title {
    font-size: 1.6rem;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .btn-action {
    flex: 1 1 100%;
    width: 100%;
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
  
  .history-section {
    padding: 20px 15px;
  }
}
