/* ==============================
   ROOT VARIABLES (add if missing)
============================== */
:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --text-muted: #64748b;
  --border-color: #cbd5e1;
}

/* ==============================
   TOOL PAGE STYLES
============================== */

.tool-card {
  max-width: 680px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
  padding: 40px;
  border: 1px solid #f1f5f9;
}

@media (max-width: 640px) {
  .tool-card {
    padding: 24px 18px;
    border-radius: 14px;
    margin: 0 12px;
  }
}

#progress {
  font-weight: 500;
  color: var(--primary);
}

input[type="file"] {
  border-radius: 8px;
}

/* ==============================
   WRAPPER & CONTAINER
============================== */

.tool-wrapper {
  padding: 60px 20px 80px;
  min-height: 100vh;
  background: #f8fafc;
}

.tool-container {
  max-width: 720px;
  margin: auto;
}

/* ==============================
   TITLE
============================== */

.tool-title {
  text-align: center;
  margin-bottom: 36px;
}

.tool-title h1 {
  font-size: clamp(26px, 5vw, 38px);
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.5px;
  margin: 0 0 10px;
}

.tool-title p {
  color: #64748b;
  font-size: clamp(14px, 2.5vw, 16px);
  max-width: 460px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ==============================
   UPLOAD DROP ZONE
============================== */

.upload-box {
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
  padding: 50px 24px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.3s ease;
}

.upload-box:hover {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.04);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.1);
}

.upload-box.dragover {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.08);
  transform: scale(1.01);
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 16px;
  color: var(--primary);
  line-height: 1;
}

.upload-box h3 {
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 6px;
}

.upload-box h3 span {
  color: var(--primary);
}

.upload-box small {
  font-size: 13px;
  color: #94a3b8;
}

.upload-box input[type="file"] {
  display: none;
}

/* ==============================
   FILE INFO
============================== */

.file-info {
  margin-top: 16px;
  font-size: 14px;
  color: #64748b;
}

.file-info span {
  display: inline-block;
  background: #f1f5f9;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  margin: 4px;
}

/* ==============================
   VIDEO PREVIEW
============================== */

#previewContainer {
  margin-top: 20px;
}

#previewContainer video,
#videoPreview {
  width: 100%;
  border-radius: 12px;
  background: #000;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* ==============================
   COMPRESSION CONTROLS — CRITICAL FIX
============================== */

.tool-controls {
  margin-top: 28px;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.tool-controls .form-group,
.tool-controls .mb-3 {
  display: block !important;
  visibility: visible !important;
}

.tool-controls label {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 10px;
  display: block;
  color: #0f172a;
}

.tool-controls select,
.tool-controls .form-control,
.tool-controls .form-select,
#compressionLevel {
  display: block !important;
  visibility: visible !important;
  width: 100%;
  border-radius: 12px;
  padding: 14px 40px 14px 16px;
  border: 1px solid #e2e8f0;
  font-size: 15px;
  font-family: inherit;
  color: #0f172a;
  background-color: #fff;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
}

.tool-controls select:focus,
#compressionLevel:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

/* ==============================
   COMPRESS BUTTON
============================== */

.btn-primary,
#compressBtn {
  width: 100%;
  margin-top: 24px;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
  letter-spacing: 0.3px;
}

.btn-primary:hover:not(:disabled),
#compressBtn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(79, 70, 229, 0.45);
  background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
}

.btn-primary:active:not(:disabled),
#compressBtn:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled,
#compressBtn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* ==============================
   SPINNER
============================== */

.spinner-border {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: tool-spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes tool-spin {
  to { transform: rotate(360deg); }
}

/* ==============================
   PROGRESS BAR
============================== */

.progress-wrapper {
  margin-top: 24px;
}

.progress {
  height: 10px;
  border-radius: 100px;
  overflow: hidden;
  background: #e2e8f0;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4f46e5, #818cf8);
  border-radius: 100px;
  transition: width 0.4s ease;
}

.progress-text {
  margin-top: 10px;
  font-size: 13px;
  text-align: center;
  color: #64748b;
}

/* ==============================
   RESULT BOX
============================== */

/* Result */
.result-box {
  margin-top: 24px;
  text-align: center;
  animation: fadeUp 0.4s ease;
  width: 100%;
  box-sizing: border-box;
}

.result-box .alert-success,
.result-box .result-card {
  background: #d1fae5;
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  padding: 20px;
  color: #065f46;
  font-size: 14px;
  word-wrap: break-word;
}

.result-box .btn-success,
.result-box a.download-btn,
.result-box a.btn-success {
  display: inline-block;
  margin-top: 16px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: #10b981;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal;
  word-break: break-word;
}

/* ==============================
   ERROR BOX
============================== */

.alert-danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 14px;
  margin-top: 16px;
  font-weight: 500;
}

/* ==============================
   UTILITIES
============================== */

.d-none {
  display: none !important;
}

/* Responsive Grid for Time Inputs */
@media (max-width: 768px) {
    .tool-controls .row > div {
        margin-bottom: 15px;
    }
}

.input-icon-wrap {
    position: relative;
    width: 100%;
}

.input-icon-wrap i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 12px;
}

.input-icon-wrap input.form-control {
    padding-left: 35px !important;
    height: 48px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.duration-hint {
    background: #f1f5f9;
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    margin-top: 10px;
    font-weight: 600;
}
