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

html {
    height: 100%;
    width: 100%;
    font-family: Arial, sans-serif;
}

body {
    font-family: 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow: hidden;
}

.editor-container {
    display: flex;
    height: 100vh;
    background: #f8f9fa;
}

/* Sidebar */
.sidebar {
    width: 200px;
    background: #ffffff;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    padding: 20px 10px;
    padding-top: 0;
    overflow-y: auto;
    transition: transform 0.3s ease;
    animation: fadeIn 0.5s ease;
}

.sidebar-header {
    position: sticky;
    background-color: white;
    top: 0;
    padding: 20px;
    margin-bottom: 20px;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    border-bottom: 1px solid #dee2e6;
}

.sidebar-header h3 {
    font-size: 14px;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.page-thumbnail {
    margin-bottom: 15px;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    aspect-ratio: 9/16;
}

.page-thumbnail:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.page-thumbnail.active {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.page-thumbnail img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.page-number {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #e9ecef;
}

/* Header */
.header {
    background: white;
    padding: 15px 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    position: sticky;
    top: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.back-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #495057;
    cursor: pointer;
    padding: 5px 10px;
    transition: color 0.3s ease;
}

.back-btn:hover {
    color: #667eea;
}

.project-title {
    font-size: 20px;
    color: #212529;
    font-weight: 600;
}

.header-right {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-save {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.btn-save:hover {
    background: #e9ecef;
}

.btn-download {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Canvas Area */
.canvas-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: auto;
    position: relative;
}

.canvas-wrapper {
    background: rgba(255, 255, 255, 0);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    position: relative;
    width: auto;
    max-width: 450px;
    aspect-ratio: 9/16;
    max-height: calc(100vh - 120px);
}

.swiper {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    animation: fadeIn 0.5s ease;
}

.swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #ffffff00;
}

.slide-content {
    width: 100%;
    height: 100%;
    position: relative;
    aspect-ratio: 9/16;
}

.slide-image {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 12px;
    object-fit: cover;
}

.text-overlay {
    position: absolute;
    cursor: move;
    padding: 10px;
    min-width: 100px;
    min-height: 40px;
    border: 2px dashed transparent;
    transition: border-color 0.3s ease;
    outline: none;
    word-wrap: break-word;
    overflow: hidden;
}

.text-overlay:focus,
.text-overlay.selected {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #667eea;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.2s ease;
    z-index: 10;
}

.resize-handle::before {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: transparent;
}

.text-overlay.selected .resize-handle {
    opacity: 1;
}

.resize-handle:hover {
    transform: scale(1.2);
    background: #764ba2;
}

.resize-handle.se {
    bottom: -6px;
    right: -6px;
    cursor: nwse-resize;
}

.resize-handle.sw {
    bottom: -6px;
    left: -6px;
    cursor: nesw-resize;
}

.resize-handle.ne {
    top: -6px;
    right: -6px;
    cursor: nesw-resize;
}

.resize-handle.nw {
    top: -6px;
    left: -6px;
    cursor: nwse-resize;
}

.text-overlay:empty:before {
    content: 'Click to edit text';
    color: #adb5bd;
    font-style: italic;
}

/* Swiper Navigation */
.swiper-button-next,
.swiper-button-prev {
    color: #667eea;
    background: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.swiper-button-next:after,
.swiper-button-prev:after {
    font-size: 18px;
    font-weight: bold;
}

.swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background: #667eea;
    opacity: 0.4;
}

.swiper-pagination-bullet-active {
    opacity: 1;
    width: 24px;
    border-radius: 5px;
}

/* Right Panel */
.right-panel {
    width: 320px;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.panel-section {
    margin-bottom: 25px;
}

.panel-section h4 {
    font-size: 13px;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
    font-weight: 600;
}

.control-group {
    margin-bottom: 15px;
}

.control-label {
    display: block;
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 8px;
    font-weight: 500;
}

.control-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.control-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.control-row {
    display: flex;
    gap: 10px;
}

.control-row .control-group {
    flex: 1;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-preview {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 2px solid #dee2e6;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.color-preview:hover {
    transform: scale(1.1);
}

.color-input {
    opacity: 0;
    position: absolute;
    pointer-events: none;
}

.button-group {
    display: flex;
    gap: 8px;
}

.icon-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    color: #495057;
}

.icon-btn:hover {
    background: #f8f9fa;
    border-color: #667eea;
    color: #667eea;
}

.icon-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.alignment-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.add-text-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.add-text-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.delete-text-btn {
    width: 100%;
    padding: 12px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.delete-text-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
    background: #c82333;
}

.delete-text-btn:disabled {
    background: #dee2e6;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

textarea.control-input {
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
    padding: 4px 6px;
    margin: 0;
}


.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #dee2e6;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.slider-value {
    min-width: 40px;
    text-align: right;
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 200;
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .right-panel {
        width: 280px;
    }
}

@media (max-width: 768px) {
    .right-panel {
        position: absolute;
        right: 0;
        top: 0;
        height: 100%;
        z-index: 200;
        transform: translateX(100%);
    }

    .right-panel.active {
        transform: translateX(0);
    }
}

