/* GLOBAL RESET AND FONT */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* BODY AND LAYOUT */
body {
  min-height: 100vh;
  display: flex;
  font-family: 'Poppins', sans-serif;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background-color: #f4f7f6; /* Light, soft background */
}

.container {
  width: 100%;
  max-width: 650px; /* Slightly wider for a better form flow */
}

/* MAIN FORM CONTAINER */
.form-bg {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px;
  background-color: #ffffff; /* Crisp white background */
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); /* Modern, soft shadow */
  width: 100%;
  padding-bottom: 30px;
}

/* HEADER STYLES */
.h2-bg {
  color: #28a745;
  border-bottom: 1px solid #e0e0e0; /* Lighter divider */
  padding-bottom: 15px;
  margin-bottom: 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0 10px 15px;
}

.h2-bg img {
  border: 2px solid #28a745;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  object-fit: cover;
}

h4 {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
  color: #333;
}

/* INPUT FORM ELEMENTS */
.input-form {
  width: 100%;
  margin-bottom: 20px;
}

.input-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #333;
  font-size: 14px;
}

.input, select, textarea {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  font-family: 'Poppins', sans-serif;
  color: #333;
  background-color: #fff;
  transition: all 0.2s ease-in-out;
  resize: vertical;
}

.input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #28a745;
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.15);
}

.input::placeholder, textarea::placeholder {
  color: #a0a0a0;
}

/* TEXTAREA SPECIFIC STYLES */
textarea.input {
  min-height: 100px;
}

/* SELECT (DROPDOWN) STYLES - Modern look */
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2328a745'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 15px;
  padding-right: 40px; /* Space for arrow */
}

select:invalid {
  color: #6c757d;
}

/* FILE INPUT (MEDIA) STYLES */
.file-section {
  margin-bottom: 25px;
  width: 100%;
}

.file-section label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #333;
  font-size: 14px;
}

.media-input {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #f9f9f9;
}

.media-input:focus {
  border-color: #28a745;
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.15);
}

.preview-container {
  margin-top: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preview-container img, .preview-container video {
  max-width: 100%;
  max-height: 180px;
  border-radius: 6px;
  object-fit: contain;
  border: 1px solid #e0e0e0;
}

/* QUANTITY FIELD STYLES (FROM HTML <style> block, modernizing here) */
.quantity-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid #ddd; /* Match form border style */
    border-radius: 8px; /* Match form border radius */
    background: #f9f9f9;
    max-width: 100%; /* Changed from 300px to be responsive */
    overflow: hidden;
}

.quantity-input {
    width: 100%; /* Ensure it fills the wrapper minus buttons */
    max-width: 220px; /* Optional: cap size on larger screens */
    text-align: center;
    border: none;
    outline: none;
    height: 44px; /* Taller for modern look */
    font-size: 18px; /* Larger font */
    background: transparent;
    font-family: 'Poppins', sans-serif;
    padding: 0 5px;
    -moz-appearance: textfield; /* Hide arrows on Firefox */
}

/* Hide arrows on Chrome/Safari/Edge */
.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quantity-btn {
    background: #28a745;
    color: white;
    border: none;
    width: 44px; /* Square button */
    height: 44px;
    cursor: pointer;
    font-size: 20px; /* Larger icon/text */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    user-select: none;
    flex-shrink: 0;
}

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

.quantity-btn:active {
    background: #1e7e34;
}

.quantity-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.quantity-info {
    font-size: 13px;
    color: #666;
    margin-top: 5px;
    display: block;
}


/* TAB HEADER STYLES */
.tab-header {
  display: flex;
  justify-content: center;
  margin: 10px 0 25px 0;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.tab-button {
  flex: 1;
  padding: 14px;
  cursor: pointer;
  border: none;
  background: #e9ecef;
  color: #555;
  font-weight: 500;
  transition: background-color 0.3s, color 0.3s;
  font-size: 15px;
}

.tab-button:first-child { border-radius: 8px 0 0 8px; }
.tab-button:last-child { border-radius: 0 8px 8px 0; }

.tab-button.active {
  background: #28a745;
  color: white;
}

.tab-button:hover:not(.active) {
  background: #dee2e6;
}

/* PUBLISH BUTTON */
.publish-button {
  background-color: #28a745;
  color: white;
  width: 100%;
  max-width: 300px;
  padding: 12px;
  border: none;
  border-radius: 50px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s, box-shadow 0.3s;
  margin-top: 15px;
  box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

.publish-button:hover {
  background-color: #218838;
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.5);
}

.publish-button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  box-shadow: none;
}

/* UTILITY/FEEDBACK */
.error {
  color: #dc3545; /* Bootstrap Red */
  font-size: 13px;
  margin-top: 5px;
  display: block;
}

#sellerEarningsInfo {
  font-size: 13px;
  color: #198754; /* Darker green for better contrast */
}

p {
  text-align: center;
  font-size: 13px;
  color: #6c757d;
  line-height: 1.5;
}

a {
  text-decoration: none;
  color: #28a745;
  font-weight: 500;
}

a:hover {
  text-decoration: underline;
}

/* TOAST/MODAL STYLES (Loading/Processing) */
.toast-message {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #28a745;
  color: white;
  border-radius: 8px;
  padding: 10px 20px;
  display: none;
  z-index: 9999;
  text-align: center;
  width: 80%;
  max-width: 400px;
  font-size: 14px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.loading-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.loading-content {
  background: white;
  padding: 30px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.3);
  min-width: 250px;
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #28a745;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* VIDEO EDITOR MODAL STYLES */
.video-editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    z-index: 9999;
    overflow: auto;
    padding: 20px 0;
    align-items: flex-start; /* Align to top when content is tall */
    justify-content: center;
}

.video-editor-container {
    max-width: 800px;
    margin: 20px auto;
    background: white;
    border-radius: 12px;
    position: relative;
    min-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    width: 95%;
}

.video-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.video-editor-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
    font-family: 'Poppins', sans-serif;
}

.close-editor {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.close-editor:hover {
    background: #e0e0e0;
}

.video-editor-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.video-preview-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.video-canvas-container {
    position: relative;
    width: 100%;
    max-width: 700px; /* Constrain video width */
    aspect-ratio: 16/9; /* Standard video ratio */
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

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

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.video-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    width: 100%;
    max-width: 700px;
}

.control-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
}

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

/* Text overlay styles */
.text-overlay {
    position: absolute;
    color: white;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    cursor: move;
    pointer-events: all;
    padding: 8px 12px;
    border: 2px dashed transparent;
    min-width: 80px;
    text-align: center;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    font-family: 'Poppins', sans-serif;
    user-select: none;
    white-space: nowrap;
}

.text-overlay.selected {
    border-color: #28a745;
    background: rgba(40,167,69,0.4);
}

/* Timeline section */
.timeline-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.timeline-section label {
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    display: block;
    font-family: 'Poppins', sans-serif;
}

.timeline-container {
    position: relative;
    height: 60px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
    margin: 15px 0;
    cursor: pointer;
}

.timeline-track {
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(90deg, #444, #444 10px, #555 10px, #555 20px);
}

.trim-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 20px;
    background: #28a745;
    cursor: ew-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: bold;
    z-index: 2;
    transition: background-color 0.2s;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.trim-handle:hover {
    background: #218838;
}

.trim-handle.start {
    left: 0;
    border-radius: 4px 0 0 4px;
}

.trim-handle.end {
    right: 0;
    border-radius: 0 4px 4px 0;
}

.playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #ffcc00; /* Bright color for playhead */
    cursor: pointer;
    z-index: 3;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
    transition: left 0.05s linear;
}

.trim-info {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #666;
    margin-top: 10px;
    font-family: 'Poppins', sans-serif;
}

/* Text tools section */
.text-tools-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

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

.tools-header h4 {
    margin: 0;
    color: #333;
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
}

.tool-btn {
    background: #007bff; /* Blue for 'Add Text' */
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    transition: background-color 0.2s;
}

.tool-btn:hover {
    background: #0056b3;
}

.text-editor {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.text-editor input[type="text"] {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
    outline: none;
}

.text-editor input[type="text"]:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40,167,69,0.2);
}

.text-options {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.text-options select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: 'Poppins', sans-serif;
    background: white;
    width: auto; /* Override select width for small controls */
}

.text-options input[type="color"] {
    width: 50px;
    height: 38px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
}

.text-options button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    transition: background-color 0.2s;
}

#apply-text-btn {
    background: #28a745;
    color: white;
}

#apply-text-btn:hover {
    background: #218838;
}

#cancel-text-btn {
    background: #dc3545;
    color: white;
}

#cancel-text-btn:hover {
    background: #c82333;
}

/* Compression settings */
.compression-settings {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.compression-settings h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
}

.quality-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quality-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: normal;
}

/* Editor actions */
.editor-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.action-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    transition: all 0.2s;
}

.action-btn.cancel {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
}

.action-btn.cancel:hover {
    background: #e9ecef;
}

.action-btn.process {
    background: #28a745;
    color: white;
}

.action-btn.process:hover {
    background: #218838;
}

.edit-video-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    margin-top: 10px;
    transition: background-color 0.2s;
    width: 100%;
    max-width: 200px;
    align-self: flex-start;
}

.edit-video-btn:hover {
    background: #0056b3;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .container {
        padding: 0;
    }
    .form-bg {
        padding: 20px 15px;
        box-shadow: none;
        border-radius: 0;
    }
    h4 {
        font-size: 20px;
    }
    
    /* Editor mobile adjustments */
    .video-editor-modal {
        padding: 0;
    }
    .video-editor-container {
        margin: 0;
        min-height: 100vh;
        border-radius: 0;
        width: 100%;
    }
    
    .video-editor-content {
        padding: 15px;
    }
    
    .video-canvas-container {
        max-height: 250px;
        aspect-ratio: auto;
    }
    
    .text-options {
        flex-direction: column;
        align-items: stretch;
    }
    
    .text-options select, .text-options button {
        width: 100%;
    }
    
    .editor-actions {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
}
