/* Crop Video Tool — extends trim/css/style.css */

/* Crop overlay sits on top of the video player */
.trim-video-wrap {
    position: relative;
}

.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.crop-box {
    position: absolute;
    border: 2px solid #fff;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
    cursor: move;
    pointer-events: auto;
    top: 10%;
    left: 10%;
    width: 80%;
    height: 80%;
    box-sizing: border-box;
}

/* Rule-of-thirds grid */
.crop-box::before {
    content: '';
    position: absolute;
    top: 33.33%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 calc(33.33% * 1) 0 rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

.crop-box::after {
    content: '';
    position: absolute;
    left: 33.33%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, 0.4);
    box-shadow: calc(33.33% * 1) 0 0 rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

.crop-handle {
    position: absolute;
    width: 18px;
    height: 18px;
    background: #fff;
    border: 2px solid var(--color-accent, #06b6d4);
    border-radius: 50%;
    pointer-events: auto;
    z-index: 10;
    box-sizing: border-box;
}

.crop-handle.top-left     { top: -9px;    left: -9px;    cursor: nwse-resize; }
.crop-handle.top-right    { top: -9px;    right: -9px;   cursor: nesw-resize; }
.crop-handle.bottom-left  { bottom: -9px; left: -9px;    cursor: nesw-resize; }
.crop-handle.bottom-right { bottom: -9px; right: -9px;   cursor: nwse-resize; }
.crop-handle.top-center   { top: -9px;    left: 50%;     transform: translateX(-50%); cursor: ns-resize; }
.crop-handle.bottom-center{ bottom: -9px; left: 50%;     transform: translateX(-50%); cursor: ns-resize; }
.crop-handle.left-center  { left: -9px;   top: 50%;      transform: translateY(-50%); cursor: ew-resize; }
.crop-handle.right-center { right: -9px;  top: 50%;      transform: translateY(-50%); cursor: ew-resize; }

/* Inline video controls below the player */
.crop-video-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--color-bg-card, #0f172a);
    border: 1px solid var(--color-border, #1e293b);
    border-radius: 10px;
}

.crop-video-controls .control-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--color-accent-subtle, rgba(6, 182, 212, 0.15));
    color: var(--color-accent, #06b6d4);
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.crop-video-controls .control-btn:hover {
    background: var(--color-accent, #06b6d4);
    color: #fff;
}

.crop-video-controls .video-seek {
    flex: 1;
    height: 5px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--color-border, #1e293b);
    border-radius: 3px;
    cursor: pointer;
}

.crop-video-controls .video-seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--color-accent, #06b6d4);
    border-radius: 50%;
    cursor: pointer;
}

.crop-video-controls .video-seek::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--color-accent, #06b6d4);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.crop-video-controls #videoTime {
    font-size: 0.85rem;
    color: #94a3b8;
    white-space: nowrap;
    min-width: 90px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Aspect ratio buttons */
.aspect-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.aspect-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--color-bg-card, #0f172a);
    border: 1px solid var(--color-border, #1e293b);
    border-radius: 10px;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 72px;
    font-size: 0.85rem;
    font-weight: 500;
}

.aspect-btn i {
    font-size: 1rem;
    color: #94a3b8;
}

.aspect-btn:hover {
    border-color: var(--color-accent, #06b6d4);
    color: #fff;
}

.aspect-btn:hover i {
    color: var(--color-accent, #06b6d4);
}

.aspect-btn.active {
    background: var(--color-accent-subtle, rgba(6, 182, 212, 0.15));
    border-color: var(--color-accent, #06b6d4);
    color: var(--color-accent, #06b6d4);
}

.aspect-btn.active i {
    color: var(--color-accent, #06b6d4);
}

/* Dimension display */
.crop-dimension-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--color-bg-card, #0f172a);
    border: 1px solid var(--color-border, #1e293b);
    border-radius: 10px;
    font-family: 'Outfit', system-ui, sans-serif;
}

.crop-dimension-display .dim-label {
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 500;
}

.crop-dimension-display .dim-value {
    color: var(--color-accent, #06b6d4);
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 50px;
    text-align: right;
}

.crop-dimension-display .dim-unit {
    color: #64748b;
    font-size: 0.8rem;
}

.crop-dimension-display .dim-separator {
    color: #64748b;
    font-size: 1rem;
    margin: 0 4px;
}

@media (max-width: 600px) {
    .aspect-buttons {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    .aspect-btn { min-width: 0; padding: 10px 4px; }

    .crop-handle { width: 22px; height: 22px; }
    .crop-handle.top-left     { top: -11px; left: -11px; }
    .crop-handle.top-right    { top: -11px; right: -11px; }
    .crop-handle.bottom-left  { bottom: -11px; left: -11px; }
    .crop-handle.bottom-right { bottom: -11px; right: -11px; }
    .crop-handle.top-center, .crop-handle.bottom-center { top: auto; }
    .crop-handle.top-center   { top: -11px; }
    .crop-handle.bottom-center{ bottom: -11px; }
    .crop-handle.left-center  { left: -11px; }
    .crop-handle.right-center { right: -11px; }
}
