:root {
    --primary-color: #667eea;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-color: #28a745;
    --background-color: #F2F4F7;
    --white: #ffffff;
    --black: #000000;
    --gray-50: #fafafa;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #939393;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --border-color: #E2E2E2;
    --border-radius: 8px;
    --border-radius-lg: 20px;
    --box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    --box-shadow-hover: 0 12px 35px rgba(102, 126, 234, 0.4);
    --transition: all 0.3s ease;
}

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

html,
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    font-size: 16px;
}

body {
    background: var(--background-color);
    display: flex;
    justify-content: center;
    border-radius: var(--border-radius-lg);
    max-height: calc(100% - 2rem);
}

a,
button {
    text-decoration: none;
    cursor: pointer;
}

.container {
    position: relative;
    width: 320px;
    height: 600px;
    padding: 0 1rem;
    margin: auto;

    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow);
    padding-bottom: 5.5rem !important;
}

.header {
    text-align: center;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header h1 {
    font-weight: 500;
    color: var(--black);
    font-size: 1.375rem;
}

.video-preview,
.upload-area {
    height: 86px;
    border-radius: 10px;
    border: 1px dashed #ddd;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--gray-50);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background: #f8f9ff;
}

.upload-area.dragover {
    background: #f0f4ff;
}

.upload-icon {
    color: var(--primary-color);
}

.upload-text {
    font-size: 1.125rem;
    font-weight: 400;
    color: var(--gray-500);
    line-height: 120%;
}

.video-preview {
    display: none;
}

.video-preview.show {
    display: flex;
    padding: 10px;
    align-items: center;
    flex-direction: row;
    /* gap: 15px; */
    /* border: 1px dotted var(--gray-200); */
}

.video-thumbnail {
    width: 30%;
    padding-top: 24%;
    border-radius: var(--border-radius);
    background: #333;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 20px;
}

.video-info {
    flex: 1;
    font-size: 15px;
    text-align: left;
    padding: 0 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.video-title {
    font-weight: 700;
    line-height: 100%;
    color: rgba(39, 39, 39, 1);
    /* margin-bottom: 20px; */
}

.video-details {
    font-weight: 400;
    /* font-size: 15px; */
    color: rgba(147, 147, 147, 1);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
    
}

:root {
    --controls-gap: 10px;
}

.controls {
    margin-top: var(--controls-gap);
    gap: var(--controls-gap);
    display: grid;
}

.control-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.control-label {
    font-weight: 400;
    line-height: 100%;
    color: var(--black);
    min-width: fit-content;
}

.control-select {
    padding: 0.625rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--white) url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 0H0L6 8L12 0Z' fill='%23939393'/%3E%3C/svg%3E") no-repeat;
    background-position: right 12px center;
    background-size: 12px 8px;
    color: var(--black);
    min-width: 179px;
    cursor: pointer;
    font-weight: 400;
    line-height: 120%;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.control-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 24px;
    background: #ddd;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.toggle-switch.active {
    background: var(--primary-color);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: var(--white);
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.toggle-switch.active::after {
    transform: translateX(26px);
}

.volume-slider {
    width: 100%;
    height: 3px;
    background: linear-gradient(to right, var(--gray-500) var(--volume-percentage, 33.33%), #D9D9D9 var(--volume-percentage, 33.33%), #D9D9D9 100%);
    border-radius: 2px;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 23px;
    height: 23px;
    background: var(--white);
    border: 3px solid var(--gray-500);
    border-radius: 50%;
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.25);
}

.volume-text {
    font-size: 14px;
    color: rgba(136, 136, 136, 1);
    font-weight: 400;
    min-width: 40px;
    text-align: right;
}

.convert-btn-container {
    width: 100%;
    position: absolute;
    bottom: 2rem;
    left: 0;
    padding: 0 1rem;
}

.convert-btn {
    width: 100%;
    padding: 1.125rem;
    font-size: 1rem;
    font-weight: 600;
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--border-radius);
    color: var(--white);
    transition: var(--transition);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);

}

.convert-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-hover);
}

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

.modal-trim,
.modal-rotate,
.modal-crop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-trim-crop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(123, 123, 123, 0.5);
    display: none;
    justify-content: center;
    align-items: flex-end;
    z-index: 1000;
    border-radius: 24px;
    overflow: hidden;
    transition: opacity 0.3s ease-in-out;
}

.modal-trim-crop.show {
    opacity: 1;
}

.modal-trim-content,
.modal-rotate-content,
.modal-crop-content {
    background: var(--white);
    max-width: 90%;
    width: 400px;
    color: #333;
    box-shadow: var(--box-shadow);
}

.modal-trim-crop-content {
    background: var(--white);
    width: 100%;
    padding: 16px;
    border-radius: 12px 12px 0 0;
    max-width: 100%;
    min-height: 50vh;
    color: #333;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    box-sizing: border-box;
    overflow-x: hidden;
}

.modal-trim-crop.show .modal-trim-crop-content {
    transform: translateY(0);
    overflow: hidden;
    margin: 0;
}

.trim-crop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.trim-crop-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--black);
    margin: 0;
}

.trim-crop-close {
    background: none;
    border: none;
    font-size: 40px;
    cursor: pointer;
    color: var(--gray-500);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.trim-crop-close:hover {
    background: #f5f5f5;
    color: #333;
}

.show-video-trim-crop {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin-top: 10px;
    display: block;
    border-radius: 12px;
    overflow: hidden;
    line-height: 0;
    box-sizing: border-box;
}

.show-video-trim-crop video {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    object-fit: contain;
    box-sizing: border-box;
    transition: transform 0.3s ease, clip-path 0.3s ease;
    pointer-events: auto !important; /* Ensure video can receive clicks */
    position: relative;
    z-index: 25; /* Below crop overlay but above other elements */
}

@media (max-width: 480px) {
    .show-video-trim-crop video {
        border-radius: 8px;
    }
}

.play-video-trim-crop {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    pointer-events: auto;
}

.play-video-trim-crop:hover {
    transform: translate(-50%, -50%) scale(1.1);
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4));
}

.video-timeline {
    position: relative;
    width: 100%;
}

.timeline-track {
    position: relative;
    height: 6px;
    background: var(--gray-200);
    border-radius: 4px;
    margin: 20px 0 15px 0;
    cursor: pointer;
    padding: 10px 0;
    box-sizing: content-box;
}

.timeline-segment {
    position: absolute;
    height: 6px;
    border-radius: 4px;
    top: 10px;
}

.timeline-segment-left,
.timeline-segment-right {
    background: var(--gray-200);
}

.timeline-segment-left {
    left: 0;
    width: 10%;
}

.timeline-segment-active {
    left: 10%;
    width: 80%;
    background: var(--secondary-color);
}

.timeline-segment-right {
    left: 90%;
    width: 10%;
}

.timeline-handle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    cursor: ew-resize;
    z-index: 20;
    user-select: none;
    touch-action: none;
    padding: 5px;
    box-sizing: border-box;
}

.timeline-handle-left {
    left: 10%; /* Start closer to beginning */
    transform: translate(-50%, -50%);
    margin-left: -5px;
}

.timeline-handle-right {
    left: 90%; /* Use left instead of right for consistency */
    transform: translate(-50%, -50%);
    margin-right: -5px;
}

.handle-circle {
    width: 20px;
    height: 20px;
    background: var(--white);
    border: 2px solid #BFBCBC;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    transition: all 0.2s ease;
    position: relative;
}

.handle-circle::before {
    content: '';
    position: absolute;
    top: -15px;
    left: -15px;
    right: -15px;
    bottom: -15px;
    border-radius: 50%;
    background: transparent;
    z-index: -1;
}

.timeline-handle:hover .handle-circle,
.timeline-handle:active .handle-circle {
    border-color: var(--secondary-color);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: scale(1.1);
    background: #f8f9fa;
}

.timeline-handle.dragging .handle-circle {
    border-color: var(--secondary-color);
    box-shadow: 0 6px 12px rgba(40, 167, 69, 0.3);
    transform: scale(1.2);
}

.timeline-playhead {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    cursor: ew-resize;
    z-index: 25;
    user-select: none;
    touch-action: none;
    padding: 3px;
    box-sizing: border-box;
}

.playhead-button {
    width: 24px;
    height: 24px;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    cursor: pointer;
}

.playhead-button:hover {
    border-color: var(--secondary-color);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

.playhead-button:active {
    border-color: var(--secondary-color);
    box-shadow: 0 6px 12px rgba(40, 167, 69, 0.3);
    transform: scale(1.1);
}

.playhead-triangle {
    width: 0;
    height: 0;
    border-left: 6px solid var(--gray-600);
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    margin-left: 2px;
    transition: all 0.2s ease;
}

/* Pause icon state */
.playhead-triangle.pause {
    width: 8px;
    height: 12px;
    border-left: 3px solid var(--gray-600);
    border-right: 3px solid var(--gray-600);
    border-top: none;
    border-bottom: none;
    margin-left: 0;
}

.timeline-playhead:hover .playhead-button,
.timeline-playhead:active .playhead-button {
    border-color: var(--secondary-color);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

.timeline-playhead.dragging .playhead-button {
    border-color: var(--secondary-color);
    box-shadow: 0 6px 12px rgba(40, 167, 69, 0.3);
    transform: scale(1.1);
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: -4px;
    margin-bottom: 17px;
}

.time-label {
    font-size: 14px;
    color: #BDBDBD;
    font-weight: 400;
    padding: 4px 8px;
}

.time-start {
    margin-left: 30%;
    transform: translateX(-50%);
}

.time-end {
    margin-right: 30%;
    transform: translateX(50%);
}

.btn-crop {
    width: max-content;
    border: 1px solid rgba(131, 129, 129, 1);
    padding: 10px;
    border-radius: var(--border-radius);
    background-color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-weight: 500;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.3s ease;
}

.btn-crop:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.crop-acction-btn {
    font-size: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
    margin: 1rem 0;
    color: rgba(131, 129, 129, 1);
    flex-wrap: wrap;
}

.crop-acction-btn img {
    width: 19px;
    height: 19px;
    display: none;
}

.btn-crop {

}

.btn-crop.active {
    background-color: var(--gray-500);
    color: var(--white);
}

.btn-crop-text {
    color: rgba(131, 129, 129, 1);
}

.flip-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 16px 0 18px;
    flex-wrap: wrap;
}

.flip-wrapper button {
    border: 1px solid rgba(208, 207, 207, 1);
    background-color: transparent;
    cursor: pointer;
    color: var(--white);
    padding: 10px;
    gap: 10px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.flip-wrapper button:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.flip-wrapper button.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.flip-wrapper button.active .fliptext {
    color: var(--white);
}

.flip-wrapper .fliptext {
    color: var(--gray-500);
    font-weight: 500;
    font-size: 15px;
}

.line-trim-crop {
    height: 1px;
    background: #D9D9D9;
    margin: 0 auto;
}

.advanced-btn {
    background-color: var(--white);
    border: none;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition);
    width: 20px;
    height: 20px;
}

.advanced-btn:hover {
    background-color: #f5f5f5;
}

.ads {
    min-height: 65px;
    height: fit-content;
    background-image: url('ads-bg.png');
    background-repeat: no-repeat;
    background-size: cover;
}

.ads img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-trim-content h2,
.modal-rotate-content h2,
.modal-crop-content h2 {
    margin-bottom: 20px;
    text-align: center;
    color: var(--primary-color);
    font-size: 24px;
}

.rotate-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.rotate-option {
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    color: #333;
}

.rotate-option:hover,
.rotate-option.selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
    transform: translateY(-2px);
}

.rotate-option.selected {
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.rotate-custom,
.trim-range-container,
.crop-inputs {
    margin-bottom: 20px;
}

.rotate-custom label,
.trim-crop-input-group label,
.crop-input-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.rotate-custom-input,
.trim-crop-input-group input,
.crop-input-group input,
.trim-range-value input {
    width: 100%;
    padding: 12px;
    background: var(--gray-100);
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    color: #333;
    font-size: 14px;
}

.rotate-custom-input:focus,
.trim-crop-input-group input:focus,
.crop-input-group input:focus,
.trim-range-value input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.rotate-buttons,
.trim-buttons,
.crop-buttons,
.trim-crop-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.rotate-save-btn,
.trim-save-btn,
.crop-save-btn,
.trim-crop-save-btn {
    background: var(--primary-gradient);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    padding: 12px 24px;
    flex: 1;
}

.rotate-save-btn:hover,
.trim-save-btn:hover,
.crop-save-btn:hover,
.trim-crop-save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.rotate-cancel-btn,
.trim-cancel-btn,
.crop-cancel-btn,
.trim-crop-cancel-btn {
    background: var(--gray-600);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    padding: 12px 24px;
    flex: 1;
}

.rotate-cancel-btn:hover,
.trim-cancel-btn:hover,
.crop-cancel-btn:hover,
.trim-crop-cancel-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.trim-range-value {
    display: flex;
    gap: 10px;
}

.trim-range-value input {
    flex: 1;
    width: 50%;
}

.crop-info {
    margin-bottom: 20px;
    text-align: center;
    background: var(--gray-100);
    padding: 15px;
    border-radius: var(--border-radius);
}

.crop-info p {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

.control-group-modal {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 14px;
    height: 14px;
    border: 2px solid #ddd;
    border-radius: 50%;
    background: var(--white);
    cursor: pointer;
    position: relative;
}

input[type="radio"]:checked {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 7px;
    left: 7px;
    width: 6px;
    height: 6px;
    background: var(--white);
    border-radius: 50%;
}

input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-radius: 3px;
    background: var(--white);
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

input[type="checkbox"]:checked {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 0px;
    left: 5px;
    color: var(--white);
    font-size: 12px;
    font-weight: bold;
}

input[type="checkbox"]:hover {
    border-color: var(--primary-color);
}

.crop-hint {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
    font-style: italic;
}

.control-select option:first-child,
.control-select:has(> option:first-child:checked) {
    color: var(--gray-500);
}

.control-select option {
    color: var(--black);
}

/* Crop Overlay Styles */
.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 30;
    pointer-events: none; /* Allow clicks to pass through to video */
}

.crop-selection {
    position: absolute;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    cursor: move; /* Restore move cursor */
    pointer-events: auto; /* Enable clicks for moving */
    min-width: 80px;
    min-height: 80px;
    border-radius: 4px;
    transition: box-shadow 0.2s ease;
}

.crop-handle {
    position: absolute;
    background: #ffffff;
    border: 3px solid #007bff;
    border-radius: 6px;
    width: 16px;
    height: 16px;
    z-index: 33;
    pointer-events: auto;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.crop-handle:hover {
    background: #007bff;
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.4);
}

/* Corner handles */
.crop-handle-nw {
    top: -8px;
    left: -8px;
    cursor: nw-resize;
}

.crop-handle-ne {
    top: -8px;
    right: -8px;
    cursor: ne-resize;
}

.crop-handle-sw {
    bottom: -8px;
    left: -8px;
    cursor: sw-resize;
}

.crop-handle-se {
    bottom: -8px;
    right: -8px;
    cursor: se-resize;
}

/* Removed edge handles - only corners needed */

/* crop-drag-area removed */

/* Different styling for preset modes */
.crop-selection[data-mode="1:1"],
.crop-selection[data-mode="9:16"], 
.crop-selection[data-mode="16:9"],
.crop-selection[data-mode="4:3"] {
    border-color: #28a745;
}

/* Removed crop-drag-area styling */

/* Preset mode handles - green styling to indicate constrained aspect ratio */
.crop-selection[data-mode="1:1"] .crop-handle,
.crop-selection[data-mode="9:16"] .crop-handle,
.crop-selection[data-mode="16:9"] .crop-handle,
.crop-selection[data-mode="4:3"] .crop-handle {
    background: #28a745 !important;
    border-color: #1e7e34 !important;
}

.crop-selection[data-mode="1:1"] .crop-handle:hover,
.crop-selection[data-mode="9:16"] .crop-handle:hover,
.crop-selection[data-mode="16:9"] .crop-handle:hover,
.crop-selection[data-mode="4:3"] .crop-handle:hover {
    background: #218838 !important;
    border-color: #1c7430 !important;
    transform: scale(1.1);
}

/* Active state for crop handles */
.crop-handle.dragging {
    background: #007bff;
    transform: scale(1.3);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.6);
}

/* Visual feedback for crop selection */
.crop-selection.dragging {
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7);
}

/* Responsive adjustments for crop handles */
@media (max-width: 480px) {
    .crop-handle {
        width: 16px;
        height: 16px;
        border-width: 3px;
    }
    
    .crop-handle-nw,
    .crop-handle-ne,
    .crop-handle-sw,
    .crop-handle-se {
        margin: -8px;
    }
}

/* Animation for crop overlay appearance */
.crop-overlay {
    transition: opacity 0.3s ease-in-out;
}

.crop-overlay[style*="display: block"] {
    animation: cropOverlayFadeIn 0.3s ease-out;
}

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

/* Improved crop selection border */
.crop-selection {
    border: 2px solid #ffffff;
    box-shadow: 
        0 0 0 9999px rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px rgba(255, 255, 255, 0.8),
        0 0 0 1px rgba(0, 0, 0, 0.3);
}

/* Special styling when moving */
.crop-selection.moving {
    border-color: #007bff;
    box-shadow: 
        0 0 0 9999px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(0, 123, 255, 0.6),
        inset 0 0 0 1px rgba(0, 123, 255, 0.6);
    /* Removed transform scale - it was causing unwanted size changes */
}

/* Better visual feedback during drag */
.crop-handle:active,
.crop-handle.dragging {
    background: #007bff;
    border-color: #0056b3;
    transform: scale(1.3);
    box-shadow: 
        0 4px 12px rgba(0, 123, 255, 0.6),
        0 0 0 3px rgba(0, 123, 255, 0.2);
}