@import url('../../assets/footer/footer.css');

/* ===== Base Variables ===== */
:root {
  --primary: #6c63ff;
  --primary-dark: #5a52e0;
  --primary-light: #e0deff;
  --card-bg: #ffffff;
  --bg: #f8f9fa;
  --border: #e1e4e8;
  --text: #24292e;
  --text-light: #586069;
  --error: #dc3545;
  --success: #28a745;
  --warning: #ffc107;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
  --transition: all 0.3s ease;
  --border-radius: 12px;
  --border-radius-sm: 8px;
}

/* ===== Base Styles ===== */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  padding: 0;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden; /* Prevent horizontal scrolling */
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===== Tool Header ===== */
.tool-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 2rem 0;
  margin-bottom: 2.5rem;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-md);
  width: 100%;
}

.back-button {
  position: absolute;
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  padding: 0.75rem 1.25rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
}

.back-button:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%) scale(1.02);
}

.back-button svg {
  width: 1em;
  height: 1em;
}

.tool-meta {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
}

.tool-meta h1 {
  margin: 0;
  font-size: 2.25rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tool-meta h1 svg {
  width: 1.5em;
  height: 1.5em;
}

.tool-meta p {
  margin: 1rem auto 0;
  max-width: 600px;
  opacity: 0.9;
  font-size: 1.05rem;
  line-height: 1.5;
}

/* ===== Main Content ===== */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding-bottom: 3rem;
  width: 100%;
}

/* ===== Input Group ===== */
.input-group {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  transition: var(--transition);
  width: 100%;
}

.input-group:hover {
  box-shadow: var(--shadow-lg);
}

.input-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.input-header svg {
  width: 1.75em;
  height: 1.75em;
  color: var(--primary);
}

.input-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--primary);
}

.url-input-container {
  position: relative;
  margin-bottom: 1.5rem;
  width: 100%;
}

.url-input-container svg {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
}

input[type="url"] {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  border: 2px solid var(--border);
  border-radius: var(--border-radius-sm);
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition);
  background-color: rgba(255, 255, 255, 0.8);
}

input[type="url"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-light);
  width: 100%;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  border: none;
  font-size: 1rem;
  font-family: inherit;
}

.btn svg {
  width: 1.25em;
  height: 1.25em;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 5px rgba(108, 99, 255, 0.3);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(108, 99, 255, 0.4);
}

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

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

.btn-secondary:hover {
  background: var(--primary-light);
}

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

.btn-success:hover {
  background: #218838;
}

.btn-warning {
  background: var(--warning);
  color: #212529;
}

.btn-warning:hover {
  background: #e0a800;
}

.btn-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ===== Result Section ===== */
.result {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
  transition: var(--transition);
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.5s forwards;
  width: 100%;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.result-header svg {
  width: 1.75em;
  height: 1.75em;
  color: var(--success);
}

.result-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--success);
}

/* ✅ Video responsiveness */
video, 
#video-preview {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
}

.video-container {
  position: relative;
  width: 100%;
  max-height: 500px;
  border-radius: var(--border-radius-sm);
  background: #000;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.video-container video {
  width: 100%;
  height: auto;
  display: block;
}

.video-info {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  width: 100%;
}

.video-meta {
  flex: 1;
  min-width: 200px;
}

.video-meta h3 {
  margin-top: 0;
  color: var(--primary);
}

.video-meta p {
  margin: 0.5rem 0;
  color: var(--text-light);
}

.video-meta strong {
  color: var(--text);
}

.actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ===== Loading State ===== */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  width: 100%;
}

.spinner {
  width: 3rem;
  height: 3rem;
  border: 4px solid var(--primary-light);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== Error Section ===== */
.error {
  background: rgba(220, 53, 69, 0.05);
  border-left: 4px solid var(--error);
  color: var(--error);
  padding: 1.25rem;
  border-radius: var(--border-radius-sm);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  animation: shake 0.5s;
  width: 100%;
}

.error svg {
  width: 1.5em;
  height: 1.5em;
  flex-shrink: 0;
}

.error-content {
  flex: 1;
}

.error h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.error p {
  margin: 0;
  font-size: 0.95rem;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
  .tool-header {
    padding: 1.5rem 0;
  }
  
  .back-button {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    margin-bottom: 1rem;
    justify-content: center;
    width: calc(100% - 2rem);
    margin-left: 1rem;
    margin-right: 1rem;
  }
  
  .tool-meta h1 {
    font-size: 1.75rem;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .input-group,
  .result {
    padding: 1.5rem;
  }
  
  .btn-group {
    flex-direction: column;
    width: 100%;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 1rem;
  }
  
  .tool-meta h1 {
    font-size: 1.5rem;
  }
  
  .input-group,
  .result {
    padding: 1.25rem;
  }
  
  input[type="url"] {
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
  }
  
  .url-input-container svg {
    left: 0.75rem;
  }
}

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

.fade-in {
  animation: fadeIn 0.5s forwards;
}

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

.text-center {
  text-align: center;
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 2rem; }

#download-btn, button#download-mp4 {
  background: linear-gradient(135deg, #4cafef, #1976d2);
  margin-top: 3px;
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  width: auto;
}

#download-btn:hover {
  background: linear-gradient(135deg, #1976d2, #4cafef);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.25);
}

#download-btn:active {
  transform: scale(0.97);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

#download-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.4);
}