:root {
    --export-bg-color: #1a1a2e;
    --sequence-bg-color: rgba(0, 0, 0, 0.7);
    --sequence-text-color: #4cc9f0;
    --card-bg-color: rgba(255, 255, 255, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e6e6e6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

@media (min-width: 1600px) {
    .container {
        max-width: 95%;
    }
}

@media (min-width: 2000px) {
    .container {
        max-width: 90%;
    }
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #4cc9f0, #4361ee);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.subtitle {
    font-size: 1.1rem;
    color: #a0a0c0;
    max-width: 800px;
    margin: 0 auto;
}

.main-content {
    display: flex;
    gap: 25px;
    margin-bottom: 30px;
    transition: all 0.3s ease;
}

.control-panel {
    width: 450px;
    min-width: 450px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-height: none;
    min-height: 600px;
    overflow-y: auto;
    transition: all 0.3s ease;
    position: relative;
}

.control-panel.collapsed {
    width: 50px;
    min-width: 50px;
    padding: 25px 10px;
    overflow: hidden;
}

.control-panel.collapsed .panel-title {
    opacity: 0;
    pointer-events: none;
}

.control-panel.collapsed .control-group,
.control-panel.collapsed .button-group {
    opacity: 0;
    pointer-events: none;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.collapse-toggle {
    position: absolute;
    top: 25px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: linear-gradient(90deg, #4361ee, #3a0ca3);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 10;
}

.collapse-toggle:hover {
    background: linear-gradient(90deg, #3a56d4, #2d0a8a);
    transform: scale(1.1);
}

.control-panel.collapsed .collapse-toggle {
    right: 10px;
}

.control-panel.collapsed .collapse-toggle i {
    transform: rotate(180deg);
}

.draft-item {
    cursor: pointer;
    transition: all 0.3s;
}

.draft-item.selected {
    background: rgba(76, 201, 240, 0.3);
    border: 1px solid #4cc9f0;
    box-shadow: 0 0 10px rgba(76, 201, 240, 0.3);
}

.draft-item:hover {
    background: rgba(76, 201, 240, 0.2);
}

@media (min-height: 900px) {
    .control-panel {
        min-height: 700px;
    }
}

@media (min-height: 1200px) {
    .control-panel {
        min-height: 900px;
    }
}

.preview-panel {
    flex: 2;
    min-width: 500px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.preview-stats {
    font-size: 0.9rem;
    color: #a0a0c0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-title {
    font-size: 1.5rem;
    color: #4cc9f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-title i {
    font-size: 1.3rem;
}

.control-group {
    margin-bottom: 25px;
    border: solid 1px #446283;
    border-radius: 7px;
    padding: 8px;
}

.control-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #b0b0d0;
}

.control-input {
    width: 100%;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s;
}

.control-input:focus {
    outline: none;
    border-color: #4cc9f0;
    box-shadow: 0 0 0 2px rgba(76, 201, 240, 0.2);
}

.range-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.range-value {
    min-width: 40px;
    text-align: center;
    font-weight: bold;
    color: #4cc9f0;
}

input[type="range"] {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #4cc9f0;
    border-radius: 50%;
    cursor: pointer;
}

.btn {
    padding: 12px 20px;
    background: linear-gradient(90deg, #4361ee, #3a0ca3);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    background: linear-gradient(90deg, #3a56d4, #2d0a8a);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

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

.btn-full {
    width: 100%;
}

.btn-secondary {
    background: linear-gradient(90deg, #f72585, #b5179e);
}

.btn-secondary:hover {
    background: linear-gradient(90deg, #e01e75, #9c1485);
}

.upload-area {
    border: 2px dashed rgba(76, 201, 240, 0.3);
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
    position: relative;
}

.upload-area:hover {
    border-color: #4cc9f0;
    background: rgba(76, 201, 240, 0.05);
}

.upload-icon {
    font-size: 3rem;
    color: #4cc9f0;
    margin-bottom: 15px;
}

.upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 5px;
    background: linear-gradient(90deg, #4cc9f0, #4361ee);
    width: 0%;
    transition: width 0.3s;
    border-radius: 0 0 8px 8px;
}

.upload-status {
    font-size: 0.9rem;
    margin-top: 10px;
    color: #4cc9f0;
    min-height: 20px;
}

.preview-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.grid-container-wrapper {
    flex: 1;
    overflow: hidden;
    max-height: none;
    min-height: 500px;
    border-radius: 10px;
    background-color: var(--export-bg-color);
    position: relative;
}

@media (min-height: 900px) {
    .grid-container-wrapper {
        min-height: 700px;
    }
}

@media (min-height: 1200px) {
    .grid-container-wrapper {
        min-height: 900px;
    }
}

.scroll-indicator {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #4cc9f0;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    display: none;
    z-index: 10;
}

.grid-container {
    display: grid;
    gap: 15px;
    padding: 20px;
    height: auto;
    min-height: 0;
    transition: none;
    background-color: var(--export-bg-color);
    transform-origin: 0 0;
    position: relative;
    will-change: transform;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    perspective: 1000px;
}

.grid-title {
    grid-column: 1 / -1;
    text-align: left;
    margin: 0;
    padding: 0;
    color: white;
}

.grid-title h1 {
    margin: 0 0 10px 0;
    line-height: 1.2;
}

.grid-title h2 {
    margin: 0;
    line-height: 1.2;
}

.drag-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #a0a0c0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
}

.drag-hint i {
    font-size: 4rem;
    margin-bottom: 20px;
    color: rgba(255, 255, 255, 0.1);
}

.drag-hint h3 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
}

.drag-hint p {
    margin: 0;
    font-size: 0.9rem;
}

.grid-item {
    background: var(--card-bg-color);
    border-radius: 0;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s, opacity 0.3s;
    cursor: move;
    position: relative;
    display: flex;
    flex-direction: column;
    height: auto !important;
    min-height: auto !important;
}

.grid-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.grid-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.image-container {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    width: 100%;
    overflow: hidden;
}

.drag-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: move;
    z-index: 2;
    background-color: transparent;
    pointer-events: auto;
}

.thumbnail {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    align-self: flex-start;
    pointer-events: none;
}

.sequence-label {
    position: relative;
    background: var(--sequence-bg-color);
    color: var(--sequence-text-color);
    font-weight: bold;
    padding: 8px 12px;
    border-radius: 0;
    font-size: 1rem;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    min-height: 36px;
    box-sizing: border-box;
    width: 100%;
}

.sequence-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--input-border-color, rgba(76, 201, 240, 0.5));
    color: white;
    padding: 10px 12px;
    border-radius: 3px;
    font-size: 0.9rem;
    flex: 1;
    min-width: 100px;
    outline: none;
    line-height: 1.4;
    height: 44px;
    min-height: 44px;
    box-sizing: border-box;
    text-align: left;
    overflow: visible;
}

.sequence-input:focus {
    border-color: var(--input-border-color, #4cc9f0);
    box-shadow: 0 0 0 2px rgba(76, 201, 240, 0.2);
}

.duration-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--input-border-color, rgba(76, 201, 240, 0.5));
    color: white;
    padding: 10px 6px;
    border-radius: 3px;
    font-size: 0.9rem;
    width: 45px;
    text-align: center;
    outline: none;
    line-height: 1.4;
    height: 44px;
    min-height: 44px;
    box-sizing: border-box;
    overflow: visible;
}

.duration-input:focus {
    border-color: var(--input-border-color, #4cc9f0);
    box-shadow: 0 0 0 2px rgba(76, 201, 240, 0.2);
}

.remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(220, 53, 69, 0.8);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s;
    z-index: 10;
}

.grid-item:hover .remove-btn {
    opacity: 1;
}

.remove-btn:hover {
    background: rgba(220, 53, 69, 1);
    transform: scale(1.1);
}

.footer {
    text-align: center;
    padding: 20px;
    color: #a0a0c0;
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 20px;
}

.button-group {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.dimension-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.dimension-control {
    flex: 1;
}

.dimension-control label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: #b0b0d0;
}

@media (max-width: 1100px) {
    .main-content {
        flex-direction: column;
    }
    
    .control-panel, .preview-panel {
        min-width: 100%;
        max-height: none;
    }
    
    .grid-container-wrapper {
        max-height: 600px;
    }
}

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

.export-modal {
    background: #1a1a2e;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    border: 1px solid rgba(76, 201, 240, 0.3);
}

.export-icon {
    font-size: 4rem;
    color: #4cc9f0;
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    margin: 25px 0;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, #4cc9f0, #4361ee);
    width: 0%;
    transition: width 0.3s;
}

.export-complete {
    display: none;
}

.export-settings {
    margin-top: 15px;
}

.export-format-select {
    width: 100%;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s;
}

.export-format-select:focus {
    border-color: #4cc9f0;
    box-shadow: 0 0 0 2px rgba(76, 201, 240, 0.2);
}

.export-quality-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.export-quality-label {
    font-size: 0.9rem;
    color: #b0b0d0;
    white-space: nowrap;
}

.export-quality-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    outline: none;
}

.export-quality-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #4cc9f0;
    border-radius: 50%;
    cursor: pointer;
}

.export-quality-value {
    min-width: 35px;
    text-align: center;
    font-weight: bold;
    color: #4cc9f0;
    font-size: 0.9rem;
}

.export-quality-value.disabled {
    color: #666;
    opacity: 0.6;
}
