/**
 * Video Cropper Tool - Specific Styles
 * Version 1.0
 */

/* ===== Video Container ===== */
#videoContainer {
    display: none;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    gap: 30px;
}

/* ===== Crop Workspace ===== */
.crop-workspace {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.video-crop-wrapper {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

#videoPlayer {
    width: 100%;
    display: block;
    max-height: 500px;
    object-fit: contain;
}

/* ===== Crop Overlay ===== */
.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.5);
    cursor: move;
    pointer-events: auto;
    top: 10%;
    left: 10%;
    width: 80%;
    height: 80%;
}

.crop-box::before {
    content: '';
    position: absolute;
    top: 33.33%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.5);
    box-shadow: 0 calc(33.33% * 1) 0 rgba(255, 255, 255, 0.5);
}

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

/* ===== Crop Handles ===== */
.crop-handle {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #fff;
    border: 2px solid var(--color-primary);
    border-radius: 50%;
    pointer-events: auto;
    z-index: 10;
}

.crop-handle.top-left {
    top: -10px;
    left: -10px;
    cursor: nwse-resize;
}

.crop-handle.top-right {
    top: -10px;
    right: -10px;
    cursor: nesw-resize;
}

.crop-handle.bottom-left {
    bottom: -10px;
    left: -10px;
    cursor: nesw-resize;
}

.crop-handle.bottom-right {
    bottom: -10px;
    right: -10px;
    cursor: nwse-resize;
}

.crop-handle.top-center {
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    cursor: ns-resize;
}

.crop-handle.bottom-center {
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    cursor: ns-resize;
}

.crop-handle.left-center {
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: ew-resize;
}

.crop-handle.right-center {
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: ew-resize;
}

/* ===== Video Controls ===== */
.video-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--color-bg-section);
    border-radius: var(--radius-md);
}

.control-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.control-btn:hover {
    background: var(--color-primary-dark);
    transform: scale(1.05);
}

.video-seek {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--color-border);
    border-radius: 3px;
    cursor: pointer;
}

.video-seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
}

.video-seek::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

#videoTime {
    font-size: 13px;
    color: var(--color-text-secondary);
    white-space: nowrap;
    min-width: 90px;
    text-align: right;
}

/* ===== Crop Options ===== */
.crop-options {
    text-align: center;
    padding: 25px;
    background: var(--color-bg-section);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 800px;
}

.crop-options h3 {
    margin-bottom: 25px;
    font-size: 18px;
}

.option-group {
    margin-bottom: 25px;
}

.option-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--color-text);
    font-size: 14px;
}

/* ===== Aspect Ratio Buttons ===== */
.aspect-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.aspect-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: white;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 70px;
}

.aspect-btn:hover {
    border-color: var(--color-accent);
    background: #f8faff;
}

.aspect-btn.active {
    border-color: var(--color-primary);
    background: #e8f5e8;
}

.aspect-btn i {
    font-size: 18px;
    color: var(--color-text-secondary);
}

.aspect-btn.active i {
    color: var(--color-primary);
}

.aspect-btn span {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text);
}

/* ===== Dimensions Display ===== */
.dimensions-group {
    padding: 15px;
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.dimension-inputs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.dimension-field {
    display: flex;
    align-items: center;
    gap: 5px;
}

.dim-label {
    font-weight: 600;
    color: var(--color-text-secondary);
    font-size: 13px;
}

.dim-value {
    font-weight: 700;
    color: var(--color-primary);
    font-size: 16px;
    min-width: 50px;
}

.dim-unit {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.dim-separator {
    font-size: 18px;
    color: var(--color-text-secondary);
}

/* ===== Processing Status ===== */
#processingStatus {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

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

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

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

.processing-content h3 {
    color: white;
    font-size: 24px;
    margin-bottom: 10px;
}

.processing-content p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 18px;
}

/* ===== Download Container ===== */
#downloadContainer {
    display: none;
    text-align: center;
    margin-top: 40px;
    padding: 40px 0;
}

#downloadContainer h2 {
    text-align: center;
    font-size: 30px;
    margin-bottom: 10px;
    color: var(--color-primary);
}

#downloadContainer p {
    text-align: center;
    color: var(--color-text-secondary);
    margin-bottom: 30px;
}

#resultVideo {
    max-width: 600px;
    width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
}

.download-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.download-buttons .btn {
    min-width: 180px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .aspect-buttons {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .aspect-btn {
        padding: 10px 8px;
        min-width: auto;
    }

    .aspect-btn span {
        font-size: 11px;
    }

    .video-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .video-seek {
        order: 3;
        width: 100%;
        margin-top: 10px;
    }

    #videoTime {
        min-width: auto;
    }

    .crop-handle {
        width: 24px;
        height: 24px;
    }

    .crop-handle.top-left { top: -12px; left: -12px; }
    .crop-handle.top-right { top: -12px; right: -12px; }
    .crop-handle.bottom-left { bottom: -12px; left: -12px; }
    .crop-handle.bottom-right { bottom: -12px; right: -12px; }
    .crop-handle.top-center { top: -12px; }
    .crop-handle.bottom-center { bottom: -12px; }
    .crop-handle.left-center { left: -12px; }
    .crop-handle.right-center { right: -12px; }

    .download-buttons {
        flex-direction: column;
        align-items: center;
    }

    .download-buttons .btn {
        width: 100%;
    }

    .dimension-inputs {
        flex-direction: column;
        gap: 8px;
    }

    .dim-separator {
        display: none;
    }
}

@media (max-width: 480px) {
    .aspect-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
}
