/* Main Wrapper - Fixed for footer */
.text-to-image-wrapper {
    width: 100%;
    padding: 20px;
    padding-bottom: 80px; /* Increased from 40px */
    background: #f0f2f5;
    min-height: 100vh; /* Changed from calc(100vh - 200px) */
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    display: block;
    clear: both;
}
.tti-container {
    display: flex;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
    align-items: flex-start;
    position: relative;
    z-index: 2;
}

/* Left Panel */
.tti-left {
    width: 420px;
    min-width: 420px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    padding: 25px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    position: sticky;
    top: 20px;
    z-index: 10;
}

.tti-left::-webkit-scrollbar {
    width: 6px;
}

.tti-left::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.tti-left::-webkit-scrollbar-thumb {
    background: #ff7a18;
    border-radius: 3px;
}

.tti-left::-webkit-scrollbar-thumb:hover {
    background: #e06a0e;
}

.tti-left textarea {
    width: 100%;
    height: 100px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    resize: vertical;
    font-size: 14px;
    transition: border-color 0.3s;
    font-family: inherit;
    background: #fafafa;
    box-sizing: border-box;
}

.tti-left textarea:focus {
    border-color: #ff7a18;
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 122, 24, 0.1);
}

.tti-left input[type="range"] {
    width: 100%;
    margin: 8px 0;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    transition: background 0.3s;
    box-sizing: border-box;
}

.tti-left input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ff7a18;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(255, 122, 24, 0.3);
    transition: all 0.2s;
}

.tti-left input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(255, 122, 24, 0.4);
}

.tti-left input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ff7a18;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(255, 122, 24, 0.3);
}

.tti-left input[type="color"] {
    width: 45px;
    height: 45px;
    border: 2px solid #ddd;
    padding: 2px;
    cursor: pointer;
    border-radius: 8px;
    background: #fff;
    vertical-align: middle;
    transition: border-color 0.3s;
}

.tti-left input[type="color"]:hover {
    border-color: #ff7a18;
}

.tti-left label {
    display: inline-block;
    margin: 8px 8px 5px 0;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    font-size: 14px;
}

/* Right Panel */
.tti-right {
    flex: 1;
    background: #ffffff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    text-align: center;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 20px;
    z-index: 5;
}

#imageCanvas {
    max-width: 100%;
    max-height: calc(100vh - 220px);
    height: auto;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.08);
    background: #f5f5f5;
    cursor: move;
    user-select: none;
    -webkit-user-select: none;
    object-fit: contain;
}

/* Color Group */
.color-group {
    display: flex;
    gap: 30px;
    align-items: center;
    flex-wrap: wrap;
}

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

.color-item label {
    margin: 0;
    min-width: 100px;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 10px 0;
}

.checkbox-group label {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #ff7a18;
}

/* File Upload */
.file-upload-group {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
}

.file-upload-item {
    margin-bottom: 10px;
}

.file-upload-item:last-child {
    margin-bottom: 0;
}

.file-upload-item label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.file-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.file-input-wrapper input[type="file"] {
    flex: 1;
    min-width: 200px;
    padding: 8px;
    border: 2px dashed #ccc;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    background: #fff;
    font-size: 13px;
    box-sizing: border-box;
}

.file-input-wrapper input[type="file"]:hover {
    border-color: #ff7a18;
    background: #f5f5f5;
}

.file-input-wrapper input[type="file"]::-webkit-file-upload-button {
    background: #ff7a18;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 10px;
    transition: background 0.3s;
    font-size: 13px;
}

.file-input-wrapper input[type="file"]::-webkit-file-upload-button:hover {
    background: #e06a0e;
}

.btn-remove {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    font-size: 13px;
    white-space: nowrap;
}

.btn-remove:hover {
    background: #c82333;
    transform: scale(1.05);
}

/* Select */
select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.3s;
    color: #333;
    box-sizing: border-box;
}

select:focus {
    border-color: #ff7a18;
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 122, 24, 0.1);
}

/* Headings */
hr {
    margin: 20px 0;
    border: none;
    border-top: 2px solid #f0f0f0;
}

h2, h3 {
    color: #333;
    margin-top: 0;
}

h2 {
    font-size: 24px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

h3 {
    font-size: 17px;
    margin-bottom: 12px;
    color: #555;
}

/* Buttons */
.btn-add-layer {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    width: 100%;
    transition: all 0.3s;
    font-size: 14px;
}

.btn-add-layer:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

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

.move-controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.move-controls button {
    background: #ff7a18;
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    font-size: 14px;
}

.move-controls button:hover {
    background: #e06a0e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 122, 24, 0.3);
}

.move-controls button:active {
    transform: translateY(0);
}

.rotate-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.rotate-controls .btn-rotate {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    font-size: 14px;
}

.rotate-controls .btn-rotate:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.rotate-controls .btn-reset {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    font-size: 14px;
    grid-column: span 2;
}

.rotate-controls .btn-reset:hover {
    background: #138496;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.btn-download {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    font-size: 14px;
    flex: 1;
    min-width: 120px;
}

.btn-download:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

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

.btn-clear {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    font-size: 14px;
    flex: 1;
    min-width: 120px;
}

.btn-clear:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

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

/* Layers */
.layer-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    align-items: center;
    padding: 6px;
    background: #f8f9fa;
    border-radius: 6px;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.layer-row:hover {
    background: #e9ecef;
}

.layer-row.active {
    background: #e3f2fd;
    border-color: #ff7a18;
}

.layer-row button {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    font-weight: 500;
    white-space: nowrap;
}

.layer-row button:first-child {
    flex: 1;
    background: #ff7a18;
    color: white;
    font-weight: bold;
    text-align: left;
    padding: 6px 12px;
    min-width: 80px;
}

.layer-row button:first-child:hover {
    background: #e06a0e;
}

.layer-row button:not(:first-child) {
    min-width: 30px;
    text-align: center;
}

.layer-row button:not(:first-child):hover {
    background: #dee2e6;
    transform: scale(1.05);
}

.layer-row button:last-child:hover {
    background: #dc3545;
    color: white;
}

/* Toast */
.toast {
    visibility: hidden;
    min-width: 280px;
    background: #333;
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 14px 20px;
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 9999;
    opacity: 0;
    transition: all 0.4s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    font-weight: 500;
    font-size: 14px;
}

.toast.show {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

.toast.info {
    background: #17a2b8;
}

/* Responsive */
@media (max-width: 1100px) {
    .text-to-image-wrapper {
        padding: 15px;
        padding-bottom: 60px;
        min-height: 100vh;
    }
    .tti-container {
        flex-direction: column;
        gap: 20px;
    }

    .tti-left {
        width: 100%;
        min-width: auto;
        position: static;
        max-height: none;
        padding: 20px;
    }

    .tti-right {
        width: 100%;
        padding: 20px;
        min-height: 400px;
        position: static;
    }

    #imageCanvas {
        max-height: 500px;
    }
}

@media (max-width: 600px) {
    .text-to-image-wrapper {
        padding: 10px;
        padding-bottom: 60px;
        min-height: 100vh;
    }

    .tti-left {
        padding: 15px;
    }

    .tti-right {
        padding: 15px;
        min-height: 300px;
    }

    #imageCanvas {
        max-height: 350px;
    }

    .color-group {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .color-item {
        width: 100%;
    }

    .color-item label {
        min-width: 120px;
    }

    .file-input-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .file-input-wrapper input[type="file"] {
        min-width: auto;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons button {
        width: 100%;
    }

    .move-controls {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .rotate-controls {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .rotate-controls .btn-reset {
        grid-column: span 2;
    }

    .layer-row {
        flex-wrap: wrap;
        gap: 5px;
        padding: 8px;
    }

    .layer-row button:first-child {
        flex: 1 1 100%;
        margin-bottom: 4px;
    }

    .layer-row button {
        flex: 1;
        min-width: 35px;
        padding: 5px 8px;
        font-size: 11px;
    }

    h2 {
        font-size: 20px;
    }

    .toast {
        min-width: 200px;
        font-size: 13px;
        padding: 12px 16px;
        bottom: 20px;
        left: 10px;
        right: 10px;
        transform: translateX(0) translateY(20px);
        width: auto;
    }

    .toast.show {
        transform: translateX(0) translateY(0);
    }
}