@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@500;700&display=swap');

* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body {
    font-family: 'IBM Plex Mono', monospace;
    margin: 0;
    padding: 0;
    background-color: #0a0a0a;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    touch-action: none;
}

.container {
    position: relative;
    width: 260px;
    height: 150px;
    background-color: #1a1a1a;
    border-radius: 20px;
    border: 2px solid #333;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    padding: 30px;
    cursor: pointer;
    overflow: hidden;
    margin-top: -100px;
}

.container.expanded {
    height: 400px;
    transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.upload-area {
    position: absolute;
    top: 30px;
    left: 0;
    right: 0;
    text-align: center;
}

.upload-text {
    color: white;
    font-size: 17px;
}

.upload-subtext {
    color: white;
    font-size: 12px;
    opacity: 0.7;
    min-height: 15px;
    margin: 5px 0;
}

.file-selected {
    border-color: #0ddaad;
    animation: successAnimation 0.5s ease;
}

.file-selected #drop-icon svg path {
    stroke: #0ddaad;
}

@keyframes uploadAnimation {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateY(-13px) scale(1.1);
        opacity: 0.7;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.dragging #drop-icon {
    animation: uploadAnimation 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.5));
}

.dragging #drop-icon svg path {
    transition: all 0.3s ease;
    stroke-width: 2;
}

@keyframes successAnimation {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.error {
    border-color: #ff4444 !important;
    animation: errorAnimation 0.5s ease;
}

@keyframes errorAnimation {
    0% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
    100% { transform: translateX(0); }
}

.popup-overlay {
    position: fixed;
    top: 0%;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    z-index: 1000;
}

.popup-content {
    padding: 20px;
    border-radius: 10px;
    max-width: 400px;
    text-align: center;
    color: white;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.popup-overlay.active .popup-content {
    opacity: 1;
    transform: translateY(0);
}

.control-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    visibility: hidden;
}

.container.expanded .control-panel {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.panel-section {
    margin-bottom: 20px;
    color: white;
}

.panel-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #ffffff;
}

.slider {
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, #7B68EE 0%, #7B68EE 80%, #333 80%, #333 100%);
    border-radius: 2px;
    -webkit-appearance: none;
    margin: 10px 0;
    transition: background 0.3s ease;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #7B68EE;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 0 0 rgba(123, 104, 238, 0.3);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 6px rgba(123, 104, 238, 0.3);
}

.slider:active::-webkit-slider-thumb {
    transform: scale(1.3);
    box-shadow: 0 0 0 8px rgba(123, 104, 238, 0.4);
}

.audio-buttons {
    display: flex;
    gap: 20px;
    margin: 10px 0;
}

.audio-button {
    flex: 1;
    padding: 7px;
    background: #333;
    border: 2px solid #444;
    border-radius: 8px;
    color: white;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.audio-button:hover {
    background: #444;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(123, 104, 238, 0.2);
}

.audio-button.selected {
    background: #7B68EE;
    border-color: #7B68EE;
    transform: scale(1.02);
    box-shadow: 0 0 0 3px rgba(123, 104, 238, 0.3);
}

.audio-button.selected:hover {
    background: #8B78FF;
    transform: scale(1.02) translateY(-1px);
}

@keyframes selectAnimation {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1.02); }
}

.audio-button.selected {
    animation: selectAnimation 0.3s ease;
}

.process-button {
    width: 50%;
    padding: 9px;
    background: #0ddaad;
    border: none;
    border-radius: 8px;
    color: black;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
    display: block;
    margin: 0 auto;
    margin-top: 40px;
}

.process-button:hover {
    background: #0cc99c;
}

.comparison-container {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: hidden;
}

.comparison-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.comparison-video.original {
    z-index: 1;
}

.comparison-video.compressed {
    z-index: 2;
}

.comparison-slider {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    background: white;
    cursor: col-resize;
    z-index: 3;
    left: 50%;
    transform: translateX(-50%);
}

.comparison-slider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    opacity: 0.8;
}

.result-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: min(90vw, 1200px);
    margin: 0 auto;
    padding: 20px;
}

.result-container {
    width: 100%;
    aspect-ratio: 16/9;
    max-height: 80vh;
    background-color: #1a1a1a;
    border-radius: 20px;
    border: 2px solid #333;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
    overflow: hidden;
    position: relative;
}

.comparison-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: #0a0a0a;
    display: flex;
    justify-content: center;
    align-items: center;
}

.comparison-video {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #0a0a0a;
}

.comparison-video.original {
    z-index: 1;
}

.comparison-video.compressed {
    z-index: 2;
}

.comparison-slider {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    background: white;
    cursor: col-resize;
    z-index: 3;
    left: 50%;
    transform: translateX(-50%);
}

.comparison-slider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    opacity: 0.8;
}

.media-controls {
    width: 100%;
    padding: 15px;
    background: rgba(10, 10, 10, 0.9);
    display: flex;
    align-items: center;
    gap: 15px;
}

.play-button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    width: 24px;
    height: 24px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.play-button:hover {
    opacity: 1;
    transform: scale(1.1);
}

.play-button:active {
    transform: scale(0.95);
}

.play-button svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.timeline {
    flex-grow: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.timeline-progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: white;
    border-radius: 2px;
    transition: width 0.1s linear;
}

.timeline-handle {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    transition: left 0.1s linear;
}

.timeline:hover .timeline-handle {
    transform: translate(-50%, -50%) scale(1.2);
}

.result-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1066px;
}

@keyframes playToPause {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.8);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes pauseToPlay {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.8);
    }
    100% {
        transform: scale(1);
    }
}

.play-button.to-pause {
    animation: playToPause 0.3s ease;
}

.play-button.to-play {
    animation: pauseToPlay 0.3s ease;
}

.loading-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 16px;
    z-index: 0;
    white-space: nowrap;
    opacity: 0;
    border-right: 2px solid white;
    animation: fadeIn 0.5s ease forwards,
               typing 3s steps(60) forwards,
               blink-caret 0.75s step-end infinite;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 0.8;
    }
}

@keyframes typing {
    from {
        clip-path: inset(0 100% 0 0);
    }
    to {
        clip-path: inset(0 0 0 0);
    }
}

@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: white }
}

.processing-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.processing-overlay.active {
    opacity: 1;
    visibility: visible;
}

.processing-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: processSpin 1s linear infinite;
}

@keyframes processSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.size-comparison {
    color: white;
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    background: #1a1a1a;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    position: relative;
    width: 200px;
}

.size-comparison.visible {
    opacity: 1;
    transform: translateY(0);
}

.size-row {
    display: flex;
    justify-content: space-between;
    margin: 5px 0;
}

.size-label {
    font-size: 14px;
    line-height: 1.5;
    opacity: 0.8;
}

.size-value {
    font-size: 14px;
    line-height: 1.5;
    opacity: 0.8;
}

.reduction-text {
    font-size: 12px;
    color: #0ddaad;
    margin-top: 8px;
    text-align: right;
}

.reduction-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    gap: 8px;
}

.button-group {
    display: flex;
    gap: 8px;
}

.trash-button {
    background: #ff4444;
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    font-family: inherit;
    font-size: 12px;
    color: white;
    cursor: pointer;
    transition: background 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trash-button:hover {
    background: #ff6666;
}

.trash-button svg {
    width: 14px;
    height: 14px;
}

.reduction-text {
    font-size: 12px;
    color: #0ddaad;
    margin-top: 0;
    text-align: right;
}

.download-button {
    position: static;
    transform: none;
    background: #0ddaad;
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    font-family: inherit;
    font-size: 12px;
    color: black;
    cursor: pointer;
    transition: background 0.15s ease;
}

.download-button:hover {
    background: #0cc99c;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.fade-out {
    animation: fadeOut 0.5s forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.5s forwards;
}

.footer {
    position: fixed;
    bottom: 5px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.github-link {
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.2s ease;
}

.github-link:hover {
    color: white;
}