/* CSS Variables for theming */
:root {
    --bg-color-light: #f0f2f5;
    --text-color-light: #333;
    --panel-bg-light: #ffffff;
    --border-color-light: #e0e0e0;
    --shadow-color-light: rgba(0,0,0,0.05);
    --heading-color-light: #1a202c;
    --input-bg-light: #f8f9fa;
    --input-border-light: #ced4da;
    --input-text-light: #495057;
    --footer-bg-light: #0000;
    --footer-text-light: #000000;
    --footer-border-light: #343a40;
    --canvas-wrapper-bg-light: #f9f9f9;
    --canvas-wrapper-border-light: #ddd;
    --canvas-wrapper-shadow-light: rgba(0,0,0,0.1);
    --right-panel-bg-light: #e9ecef;
    --shortcuts-bg-light: #f8f8f8;
    --shortcuts-border-light: #e0e0e0;
    --shortcuts-shadow-light: rgba(0,0,0,0.05);
    --key-bg-light: #eee;
    --key-border-light: #ccc;
    --key-color-light: #333;
    --progress-container-bg-light: #e0e0e0;
    --status-color-light: #555;
    --detailed-progress-color-light: #666;
    --button-bg-light: #007bff;
    --button-hover-light: #0056b3;
    --button-shadow-light: rgba(0,123,255,0.2);
    --button-hover-shadow-light: rgba(0,123,255,0.3);
    --button-disabled-light: #cccccc;
}

body.dark-mode {
    --bg-color-light: #2c3e50; /* Darker blue-grey */
    --text-color-light: #ecf0f1; /* Light grey */
    --panel-bg-light: #1f1f1f; /* Slightly darker panel */
    --border-color-light: #2b3b4d;
    --shadow-color-light: rgba(0,0,0,0.2);
    --heading-color-light: #ecf0f1;
    --input-bg-light: #2a2a2a;
    --input-border-light: #4a657e;
    --input-text-light: #ecf0f1;
    --footer-bg-light: #1a242f;
    --footer-text-light: #bdc3c7;
    --footer-border-light: #2c3a4d;
    --canvas-wrapper-bg-light: #253342;
    --canvas-wrapper-border-light: #3a4b5c;
    --canvas-wrapper-shadow-light: rgba(0,0,0,0.3);
    --right-panel-bg-light: #1f1f1f;
    --shortcuts-bg-light: #2a2a2a;
    --shortcuts-border-light: #4a657e;
    --shortcuts-shadow-light: rgba(0,0,0,0.2);
    --key-bg-light: #526f8c;
    --key-border-light: #6a88a6;
    --key-color-light: #ecf0f1;
    --progress-container-bg-light: #4a657e;
    --status-color-light: #bdc3c7;
    --detailed-progress-color-light: #95a5a6;
    --button-bg-light: #3498db; /* Brighter blue for buttons */
    --button-hover-light: #2980b9;
    --button-shadow-light: rgba(52,152,219,0.2);
    --button-hover-shadow-light: rgba(52,152,219,0.3);
    --button-disabled-light: #6c7a89;
}

/* Cải tiến giao diện nút */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--button-bg-light);
    color: white;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 6px var(--button-shadow-light);
}
button:hover:not(:disabled), .btn:hover:not(:disabled) {
    background-color: var(--button-hover-light);
    box-shadow: 0 6px 8px var(--button-hover-shadow-light);
}
button:disabled, .btn:disabled {
    background-color: var(--button-disabled-light);
    cursor: not-allowed;
    box-shadow: none;
}

/* Thanh tiến trình */
.progress-container {
    width: 100%;
    background: var(--progress-container-bg-light);
    border-radius: 10px; /* Rounded corners */
    margin: 15px 0;
    height: 28px; /* Taller bar */
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    position: relative; /* For absolute positioning of text */
}
#progressBar {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, #4caf50, #81c784); /* Green gradient */
    border-radius: 8px; /* Slightly less rounded than container */
    transition: width 0.4s ease-out; /* Smoother transition */
    display: flex;
    align-items: center;
    justify-content: center;
}
#progressBar .progress-text {
    color: white;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}
/* Status và Detailed Progress */
#status {
    font-size: 14px;
    color: var(--status-color-light);
    margin-top: 5px;
    text-align: center;
}
#detailedProgress {
    margin-top: 10px;
    font-size: 13px;
    color: var(--detailed-progress-color-light);
    text-align: center;
}

@font-face {
    font-family: 'Google Sans';
    src: url('fonts/GoogleSans-Bold.woff2') format('woff2'),
         url('fonts/GoogleSans-Bold.woff') format('woff');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Google Sans';
    src: url('fonts/GoogleSans-Medium.woff2') format('woff2'),
         url('fonts/GoogleSans-Medium.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Google Sans';
    src: url('fonts/GoogleSans-Regular.woff2') format('woff2'),
         url('fonts/GoogleSans-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

body {
    margin: 0;
    font-family: 'Google Sans', 'Segoe UI', sans-serif;
    background: var(--bg-color-light);
    color: var(--text-color-light);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease; /* Smooth transition */
}
.wrapper {
    display: flex;
    flex: 1; /* Allow wrapper to grow and take available space */
}
.left {
    width: 320px; /* Slightly wider for better spacing */
    background: var(--panel-bg-light);
    border-right: 1px solid var(--border-color-light);
    padding: 25px; /* More padding */
    box-shadow: 2px 0 5px var(--shadow-color-light);
    display: flex;
    flex-direction: column;
    gap: 10px; /* Spacing between controls */
    overflow-y: auto; /* Allow scrolling if content overflows */
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.left h3 {
    color: var(--heading-color-light);
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 24px;
    text-align: center;
    transition: color 0.3s ease;
}
.right {
    flex: 1;
    display: flex;
    flex-direction: column; /* Changed to column for shortcuts below canvas */
    align-items: center;
    justify-content: center;
    background: var(--right-panel-bg-light);
    position: relative;
    padding: 20px;
    transition: background-color 0.3s ease;
}

/* Form control styling */
.control-group {
    margin-bottom: 15px;
}
.control-group label {
    display: flex; /* Use flexbox for label and icon */
    align-items: center; /* Vertically align icon and text */
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--status-color-light); /* Using status-color for label for consistency */
    font-size: 14px;
    gap: 8px; /* Space between icon and text */
    transition: color 0.3s ease;
}
input[type="file"],
select,
input[type="color"],
input[type="number"] { /* Added color and number input */
    font-family: 'Google Sans', 'Segoe UI', sans-serif;
    width: 100%;
    padding: 12px 15px; /* Larger padding */
    border-radius: 8px; /* Softer corners */
    border: 1px solid var(--input-border-light);
    font-size: 16px; /* Larger font size */
    box-sizing: border-box; /* Include padding in width */
    transition: all 0.2s ease-in-out; /* Smooth transitions */
    background-color: var(--input-bg-light);
    color: var(--input-text-light);
    appearance: none; /* Remove default select arrow */
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-left: 15px; /* Adjust as icons will be next to the label, not inside the input field */
}
select {
    background-image: var(--select-arrow-svg, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236c757d'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"));
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 30px; /* Make space for custom arrow */
}

/* Dark mode select arrow color */
body.dark-mode select {
     --select-arrow-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23bdc3c7'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
}


input[type="file"] {
    padding-top: 10px;
    padding-bottom: 10px;
    line-height: normal;
}
input[type="color"] {
    height: 48px; /* Match height of other inputs */
    padding: 5px; /* Adjust padding for color swatch */
    cursor: pointer;
}
input[type="number"] {
    text-align: center; /* Center align number for better appearance */
    -moz-appearance: textfield; /* Remove arrows in Firefox */
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}


input:focus,
select:focus,
button:focus,
input[type="color"]:focus,
input[type="number"]:focus {
    border-color: #007bff; /* Blue border on focus */
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25); /* Light blue shadow */
    outline: none;
}
body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode button:focus,
body.dark-mode input[type="color"]:focus,
body.dark-mode input[type="number"]:focus {
    border-color: var(--button-bg-light); 
    box-shadow: 0 0 0 0.2rem rgba(52,152,219,0.4); 
}

#canvasWrapper {
    position: relative;
    border-radius: 18px;
    /* width and height will be set dynamically by JS */
    max-width: 90vw; /* Responsive scaling */
    max-height: calc(100vh - 40px - 80px); /* Adjust based on padding and new shortcut info */
    background: var(--canvas-wrapper-bg-light);
    border: 1px solid var(--canvas-wrapper-border-light);
    box-shadow: 0 5px 15px var(--canvas-wrapper-shadow-light); /* Deeper shadow */
    display: flex; /* Use flex to center canvas */
    align-items: center;
    justify-content: center;
    transition: width 0.3s ease, height 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease; /* Smooth transition for size changes */
    margin-bottom: 20px; /* Space between canvas and shortcuts */
}
canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: #ddd; /* Fallback/initial background */
    border-radius: 18px;
}

/* Styles for the new progress overlay */
#videoProgressOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Semi-transparent black */
    display: flex; /* Use flexbox to center content */
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 4em; /* Large font size */
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); /* Subtle shadow for readability */
    z-index: 10; /* Ensure it's on top of videoDrag and canvas */
    pointer-events: none; /* Allow clicks to pass through to elements below if needed */
    opacity: 0; /* Start hidden */
    transition: opacity 0.3s ease-in-out; /* Smooth fade in/out */
    flex-direction: column; /* To stack percentage and text vertically */
    border-radius: 18px;
}
#videoProgressOverlay.show {
    opacity: 1; /* Show when active */
}
/* New styles for overlay content */
.overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
#overlayPercentageText {
    font-size: 1.2em; /* Keep large font */
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease-out; /* Smooth scale transition */
}
#overlayPercentageText.animate-pulse {
    transform: scale(1.1); /* Slightly enlarge when animated */
}
.processing-text {
    font-size: 17px; /* Smaller than percentage */
    margin-top: 10px; /* Space between percentage and text */
    color: rgba(255, 255, 255, 0.8); /* Slightly less prominent */
    font-weight: 500;
    letter-spacing: 0.1px;
}

/* Keyboard Shortcuts Info */
#shortcutsInfo {
    background-color: var(--shortcuts-bg-light);
    border: 1px solid var(--shortcuts-border-light);
    border-radius: 8px;
    padding: 15px;
/*    width: 100%;
    max-width: 600px;*/
    box-shadow: 0 2px 5px var(--shortcuts-shadow-light);
    text-align: center;
    margin-bottom: 20px; /* Space between shortcuts and footer */
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
#shortcutsInfo h4 {
    margin-top: 0;
    color: var(--text-color-light);
    font-size: 16px;
    margin-bottom: 10px;
    transition: color 0.3s ease;
}
#shortcutsInfo ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 20px; /* Row and column gap */
}
#shortcutsInfo li {
    font-size: 14px;
    color: var(--status-color-light);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s ease;
}
#shortcutsInfo li .key {
    background-color: var(--key-bg-light);
    border: 1px solid var(--key-border-light);
    border-radius: 4px;
    padding: 3px 7px;
    font-family: monospace;
    font-weight: bold;
    color: var(--key-color-light);
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.note-quality {
    display: block;
    font-size: 13px;
    color: #888;
    margin-top: 10px;
    line-height: 1.5;
}

/* Footer Styling */
.footer {
    background-color: var(--footer-bg-light);
    color: var(--footer-text-light);
    padding: 20px 20px 0px 20px;
    text-align: center;
    font-size: 14px;
    border-top: 1px solid var(--footer-border-light);
    width: 100%;
    box-sizing: border-box; /* Include padding in width */
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.footer .container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 15px;
}

.footer p {
    margin: 0;
    line-height: 1.5;
}

.footer a {
    color: #007bff; /* Link color */
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

.footer a:hover {
    color: #0056b3;
}

/* Dark mode toggle button */
#themeToggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: var(--button-bg-light);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    z-index: 20;
}

#themeToggle:hover {
    background-color: var(--button-hover-light);
    transform: scale(1.05);
}
#mobileOverlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  animation: fadeIn 0.4s ease-in-out;
}

#mobileOverlay .overlay-message {
  background: white;
  padding: 25px 30px;
  border-radius: 12px;
  max-width: 90%;
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
  animation: slideUp 0.5s ease-out;
}

#mobileOverlay .overlay-message p {
  font-size: 16px;
  color: #333;
  margin-bottom: 20px;
  line-height: 1.6;
}

.more-tools-btn {
  display: inline-block;
  padding: 10px 18px;
  background: #007bff;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: bold;
  transition: all 0.3s ease;
}

.more-tools-btn:hover {
  background: #0056b3;
  transform: translateY(-2px);
}

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

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
#mobileOverlay .overlay-logo {
  width: 120px;
  margin-bottom: 20px;
  animation: fadeIn 0.6s ease;
}

