/* 삐약이 감성 편집 툴 전용 스타일 -> 공용 스타일로 변경 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Pretendard', sans-serif;
}

body {
    background-color: var(--off-white);
    color: var(--text-dark);
    line-height: 1.6;
}

.container {
    width: 95%;
    max-width: 1400px;
    margin: 0 auto;
}

/* Breadcrumb */
.breadcrumb-header {
    background: white;
    padding: 15px 0;
    border-bottom: 2px dashed var(--border-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}

.breadcrumb-header .container {
    font-size: 1rem;
    font-weight: 600;
}

.back-link {
    text-decoration: none;
    color: var(--accent-green);
    background: rgba(167, 227, 138, 0.15);
    padding: 5px 12px;
    border-radius: 20px;
    transition: background 0.3s;
}

.back-link:hover {
    background: rgba(167, 227, 138, 0.3);
}

.path {
    color: var(--text-gray);
    margin-left: 10px;
}

/* Main Content */
.main-content {
    padding: 40px 0 80px;
}

.text-center {
    text-align: center;
}

.header-section {
    margin-bottom: 40px;
}

.header-section h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
}

.header-section p {
    color: var(--text-gray);
    font-size: 1.1rem;
}

/* Tabs */
.tabs {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.tab-btn {
    background: white;
    border: 2px solid var(--border-color);
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 30px;
    color: var(--text-gray);
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: rgba(255, 222, 89, 0.1);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: var(--accent-yellow);
    color: var(--text-dark);
    border-color: var(--accent-yellow);
    box-shadow: 0 5px 15px var(--shadow-color);
}

/* Sections */
.tool-section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tool-section.active-section {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cards & Workspaces */
.card {
    background: white;
    padding: 40px;
    border-radius: 30px;
    border: 3px dashed var(--border-color);
    box-shadow: 0 10px 30px var(--shadow-color);
    text-align: center;
}

.card h2 {
    margin-bottom: 30px;
    font-size: 1.5rem;
}

.upload-area {
    margin-bottom: 30px;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    background: rgba(167, 227, 138, 0.05);
    border: 2px dashed var(--accent-green);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-label:hover {
    background: rgba(167, 227, 138, 0.15);
    transform: scale(1.02);
}

.upload-label .icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.upload-label span {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-gray);
}

/* Workspace details */
.workspace {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.image-container {
    max-height: 500px;
    margin-bottom: 30px;
    background: #f5f5f5;
    border-radius: 10px;
    overflow: hidden;
}

.image-container img {
    max-width: 100%;
}

.file-info-box {
    background: rgba(255, 222, 89, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 25px;
    font-weight: 600;
}

.convert-options {
    margin-bottom: 30px;
}

.convert-options label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
}

.format-select {
    width: 100%;
    max-width: 300px;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 15px;
    font-size: 1rem;
    outline: none;
}

/* Buttons */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.btn {
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent-green);
    color: white;
    box-shadow: 0 4px 15px rgba(167, 227, 138, 0.4);
}

.btn-primary:hover {
    background: #8ccf6f;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #f0f0f0;
    color: var(--text-dark);
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* Result List (Cart) Styles */
.result-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
    min-width: 80px;
    height: 80px;
    border: 1px solid #ddd;
    flex-shrink: 0;
}

.result-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ratio Buttons Active State */
.ratio-group .btn.active {
    background: var(--accent-yellow);
    color: var(--text-dark);
    border-color: var(--accent-yellow);
}

.tool-controls .btn {
    padding: 8px 15px;
    font-size: 0.95rem;
}

/* Merge Tab Styles */
.merge-grid-cell {
    position: relative;
    overflow: hidden;
    background-color: #f0f0f0; /* Empty cell color */
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.merge-grid-image {
    position: absolute;
    cursor: grab;
    user-select: none;
    -webkit-user-drag: none; /* Prevent default browser drag */
    transition: transform 0.1s ease-out;
}

.merge-grid-image.contain {
    object-fit: contain;
    width: 100%;
    height: 100%;
    position: static;
    cursor: default; /* No drag when contain */
    transform: none !important;
}

.merge-grid-image:active {
    cursor: grabbing;
}

/* Global Cart Styles */
.global-cart-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: grab;
    transition: all 0.2s;
}

.global-cart-item:hover {
    background: #fff;
    border-color: var(--accent-green);
    box-shadow: 0 4px 10px rgba(167, 227, 138, 0.2);
    transform: translateY(-2px);
}

.global-cart-item:active {
    cursor: grabbing;
}

.cart-item-thumb {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    background: #eee;
    flex-shrink: 0;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.cart-item-ext {
    font-size: 0.75rem;
    color: #999;
    background: #eee;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

.cart-item-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cart-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px;
    border-radius: 6px;
    transition: background 0.2s;
}

.cart-btn.use-btn:hover { background: rgba(167, 227, 138, 0.3); }
.cart-btn.del-btn:hover { background: rgba(255, 71, 87, 0.1); color: #ff4757; }

/* Source Files Sidebar Styles */
.source-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: grab;
    transition: all 0.2s;
    user-select: none;
}

.source-item:hover {
    background: #fff;
    border-color: #a8e063;
}

.source-item.selected {
    background: rgba(167, 227, 138, 0.15);
    border-color: #a8e063;
}

.source-item:active {
    cursor: grabbing;
}

.source-item-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.source-item-thumb {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    background: #eee;
    flex-shrink: 0;
}

.source-item-info {
    flex: 1;
    min-width: 0;
}

.source-item-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.source-item-ext {
    font-size: 0.7rem;
    color: #999;
    background: #eee;
    padding: 2px 5px;
    border-radius: 4px;
    display: inline-block;
}

/* Desktop sticky sidebars */
.source-files-sidebar, .global-cart-sidebar {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
}

/* Update main layout max-height for flex wrap safely */
.main-layout {
    min-height: 80vh;
}

/* Responsive Layout */
@media (max-width: 992px) {
    .main-layout {
        flex-direction: column;
        gap: 30px;
    }
    .source-files-sidebar, .global-cart-sidebar {
        width: 100%;
        max-height: none;
        position: static;
        min-height: auto;
    }
    .mobile-toggle-btn {
        display: inline-block !important;
    }
    #source-sidebar-body {
        transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
        overflow: hidden;
    }
    #source-sidebar-body.collapsed {
        max-height: 0 !important;
        opacity: 0;
        margin: 0;
        padding: 0;
        border: none;
    }
    .content-area {
        width: 100%;
        min-width: 0;
    }
    .merge-layout {
        flex-direction: column;
    }
    .merge-settings, .merge-preview-area {
        width: 100%;
        flex: none;
    }
    .tabs {
        flex-wrap: wrap;
    }
    .tab-btn {
        flex: 1 1 100%;
        margin-bottom: 5px;
    }
}

@media (max-width: 600px) {
    .header-section h1 {
        font-size: 1.8rem;
    }
    .card {
        padding: 20px;
    }
    .upload-label {
        padding: 30px 10px;
    }
    .format-select {
        font-size: 0.9rem;
    }
}

