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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --success-color: #10b981;
    --success-hover: #059669;
    --secondary-color: #64748b;
    --secondary-hover: #475569;
    --border-color: #e2e8f0;
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-color);
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #8b5cf6 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.header-icon {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: middle;
    margin-top: 4px;
}

header p {
    font-size: 1.1rem;
    opacity: 0.95;
}

header .tech-details {
    display: inline-block;
    white-space: nowrap;
}

main {
    padding: 40px 30px;
}

/* Drop Zone */
.drop-zone {
    border: 3px dashed var(--border-color);
    border-radius: 12px;
    padding: 60px 30px;
    text-align: center;
    transition: all 0.3s ease;
    background: var(--bg-color);
    cursor: pointer;
}

.drop-zone:hover {
    border-color: var(--primary-color);
    background: #f0f4ff;
}

.drop-zone.drag-over {
    border-color: var(--primary-color);
    background: #e0e7ff;
    transform: scale(1.02);
}

.drop-zone-content {
    pointer-events: none;
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    color: var(--primary-color);
}

.drop-zone h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text-color);
}

.drop-zone p {
    color: var(--text-muted);
    margin: 10px 0;
}

.file-label {
    display: inline-block;
    padding: 12px 32px;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease;
    pointer-events: auto;
    margin: 10px 0;
}

.file-label:hover {
    background: var(--primary-hover);
}

.hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 15px;
}

.hint-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: normal;
}

/* Processing Section */
.processing-section {
    animation: fadeIn 0.5s ease;
}

.processing-section.hidden,
.result-section.hidden,
.progress-bar.hidden,
.loading-overlay.hidden {
    display: none;
}

.video-preview {
    margin: 30px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.video-preview video {
    width: 100%;
    max-height: 50vh;
    display: block;
    object-fit: contain;
}

.info-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 30px 0;
}

.left-column,
.right-column {
    display: flex;
    flex-direction: column;
}

.right-column {
    gap: 0px;
}

.file-info,
.processing-info,
.processing-options {
    background: var(--bg-color);
    padding: 16px;
    border-radius: 12px;
}

.file-details {
    display: flex;
    flex-wrap: wrap;
    column-gap: 8px;
    align-items: baseline;
}

.file-details p {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

#fileName {
    font-weight: 600;
    color: var(--text-color);
}

#fileSize {
    color: var(--text-muted);
    font-size: 0.85rem;
}

#fileSize::before {
    content: '(';
}

#fileSize::after {
    content: ')';
}

.processing-options {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.processing-options-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.processing-options h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--text-color);
}

.option-group {
    display: flex;
    flex-direction: row;
    gap: 16px;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 0;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-color);
    user-select: none;
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.radio-label span {
    font-weight: 500;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-color);
    user-select: none;
    margin-top: 0px;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.checkbox-label span {
    font-weight: 500;
}

/* Disabled state for radio and checkbox labels */
.radio-label:has(input:disabled),
.checkbox-label:has(input:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Strikethrough for ping-pong disabled items */
.checkbox-label.ping-pong-disabled {
    text-decoration: line-through;
}

.radio-label input[type="radio"]:disabled,
.checkbox-label input[type="checkbox"]:disabled {
    cursor: not-allowed;
}

.file-info h3,
.processing-info h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--text-color);
}

.file-info p,
.processing-info p {
    color: var(--text-muted);
    margin: 6px 0;
    font-size: 0.9rem;
}

#statusMessage {
    color: var(--text-color);
    font-weight: 500;
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.btn-cancel {
    padding: 6px 16px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-cancel:hover {
    background: #dc2626;
}

.btn-cancel.hidden {
    display: none;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #8b5cf6);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

/* Buttons */
.actions {
    display: flex;
    gap: 15px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 200px;
}

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

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--secondary-hover);
}

.btn-success {
    background: var(--success-color);
    color: white;
    width: 100%;
    font-size: 1.1rem;
}

.btn-success:hover:not(:disabled) {
    background: var(--success-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Result Section */
.result-section {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 2px solid var(--border-color);
    animation: fadeIn 0.5s ease;
}

.result-section h3 {
    font-size: 1.5rem;
    color: var(--success-color);
    margin-bottom: 20px;
    text-align: center;
}

.result-info {
    text-align: center;
    margin: 20px 0;
    font-size: 1rem;
    color: var(--text-muted);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loading-content p {
    font-size: 1.2rem;
    font-weight: 500;
}

/* Footer */
footer {
    background: var(--bg-color);
    padding: 30px;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

footer p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 8px 0;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

footer a:hover {
    text-decoration: underline;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        border-radius: 0;
    }

    header h1 {
        font-size: 2rem;
    }

    header p {
        font-size: 1rem;
    }

    main {
        padding: 30px 20px;
    }

    .info-section {
        grid-template-columns: 1fr;
        display: flex;
        flex-direction: column;
        gap: 12px;
		margin-top: 16px;
		margin-bottom: 16px;
    }

    .file-info,
    .processing-info,
    .processing-options {
        padding: 4px;
    }

    /* Mobile layout: Input File, Options, Processing Status */
    .left-column {
        order: 2;
        display: contents;
    }

    .right-column {
        order: 1;
        display: contents;
    }

    .right-column .file-info {
        order: 1;
    }

    .left-column .processing-options {
        order: 2;
    }

    .right-column .processing-info {
        order: 3;
    }

    .actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* Plyr video wrapper gradient background */
.plyr__video-wrapper {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

/* Plyr progress bar margin */
.plyr__progress {
    margin-left: 16px;
    margin-right: 24px;
} 

/* Plyr fullscreen button margin */
/* .plyr__controls .plyr__controls__item:last-child {
    margin-right: 16px;
} */

/* Trim markers */
.trim-marker {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 20px;
	height: 20px;
	margin-left: -10px;
	pointer-events: auto;
	cursor: ew-resize;
	z-index: 10;
	user-select: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
}

.trim-marker-handle {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: 3px solid white;
	box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.trim-marker-start .trim-marker-handle {
	background: #10b981;
}

.trim-marker-end .trim-marker-handle {
	background: #ef4444;
}

.marker-time {
	position: absolute;
	top: -28px;
	left: 50%;
	transform: translateX(-50%);
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
	padding: 3px 8px;
	color: white;
	border-radius: 3px;
	box-shadow: 0 2px 4px rgba(0,0,0,0.2);
	user-select: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
}

.trim-marker-start .marker-time {
	background: #10b981;
}

.trim-marker-end .marker-time {
	background: #ef4444;
}

/* Crop rectangle overlay */
.crop-rect-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 2;
}

.crop-rect {
	position: absolute;
	box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
	pointer-events: auto;
	cursor: move;
	user-select: none;
	-webkit-user-select: none;
}

.crop-rect.vertical {
	border-top: 2px solid #fbbf24a0;
	border-bottom: 2px solid #fbbf24a0;
}

.crop-rect.horizontal {
	border-left: 2px solid #fbbf24a0;
	border-right: 2px solid #fbbf24a0;
}
