/* --- Global & App Layout --- */
.main-container,
.theme-view {
    font-family: Arial, sans-serif;
    background-color: #f5f5fa;
    width: 96vw;    
    display: flex;
    justify-content: center;
    box-sizing: border-box;
    overflow: hidden;
}

#loader-dots, #loader-bar, #loader-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.theme-view {
    align-items: center;
    padding: 2rem;
}

.dropzone {
    width: 100%;
    max-width: 800px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    background: #fff;
    transition: background-color 0.2s, border-color 0.2s;
}

    .dropzone:hover,
    .dropzone.active {
        background-color: #f9f9ff;
        border-color: #e5322d;
    }

/* --- Two-Pane Layout --- */
.main-container {
    flex-direction: row;
}

.left-pane {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding-right: 5rem;
    box-sizing: border-box;
    margin-top: 180px;
}

.right-pane {
    flex-shrink: 0;
    background-color: white;
    padding: 1.5rem;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    max-width: 600px;
    min-width: 350px;
    /* margin-top: 70px; */
}

/* --- Left Pane: PDF Preview Grid --- */
.pdf-thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 1rem;
    align-content: flex-start;
}

.pdf-thumbnail-item {
    background-color: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 360px;
    text-align: center;
    position: relative;
    cursor: grab;
}

.sortable-ghost {
    opacity: 0.4;
}

.thumbnail-actions {
    position: absolute;
    top: -10px;
    right: -10px;
    display: none;
    align-items: center;
    gap: 0.5rem;
    z-index: 10;
}

.pdf-thumbnail-item:hover .thumbnail-actions {
    display: flex;
}

.thumbnail-actions button {
    background-color: #333;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

    .thumbnail-actions button:hover {
        background-color: #e5322d;
    }

.thumbnail-image {
    max-width: 100%;
    border: 1px solid #eee;
    background-color: #fff;
}

.thumbnail-placeholder {
    width: 100%;
    height: 240px;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
}

.pdf-name {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.floating-action-buttons {
    position: absolute;
    top: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

    .floating-action-buttons button {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        color: white;
    }

        .floating-action-buttons button:first-child {
            background-color: #e5322d;
        }

        .floating-action-buttons button:last-child {
            background-color: white;
            color: #333;
        }

/* --- Right Pane: Options --- */
.right-pane h3 {
    font-weight: bold;
    font-size: 1.1rem;
    margin: 0 0 1rem 0;
}

.options-list {
    display: flex;
    flex-direction: column;
}

.option-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

    .option-item:hover {
        background-color: #f9f9f9;
    }

    .option-item.active {
        border-left: 3px solid #e5322d;
        padding-left: calc(1rem - 3px);
        background-color: #fff;
    }

    .option-item > div {
        display: flex;
        flex-direction: column;
    }

.option-title {
    font-weight: bold;
    color: #e5322d;
    font-size: 0.9rem;
}

.option-subtitle {
    font-size: 0.8rem;
    color: #666;
    margin-top: 4px;
}

.option-item svg {
    color: #4caf50;
    width: 24px;
    height: 24px;
}

.premium-banner {
    border-radius: 8px;
    padding: 1rem;
    margin-top: auto;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

    .premium-banner p {
        margin: 0;
    }

    .premium-banner strong {
        font-size: 1rem;
    }

.theme-btn {
    background-color: #e5322d;
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

    .theme-btn:disabled {
        background-color: #aaa;
    }

.error-message,
.status-message {
    font-weight: bold;
    margin-top: 1rem;
}

.error-message {
    color: #e5322d;
}

.status-message {
    color: #e5322d;
}

/* --- Right Pane: Options --- */
.right-pane h3 {
    font-weight: normal;
    font-size: 1.2rem;
    margin-top: 0;
}

.options-card {
    border-radius: 4px;
    overflow: hidden;
    flex-grow: 1;
    /* Allow content to take space */
}

.tab-buttons {
    display: flex;
}

    .tab-buttons button {
        flex: 1;
        padding: 1rem;
        background: #f5f5fa;
        border: 1px solid #e0e0e0;
        border-bottom: 1px solid #e0e0e0;
        cursor: pointer;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 8px;
        color: #555;
    }

        .tab-buttons button.active {
            background: white;
            border-bottom: none;
            color: black;
        }

            .tab-buttons button.active .icon-wrapper {
                color: #e5322d;
            }

        .tab-buttons button:disabled {
            color: #aaa;
            cursor: not-allowed;
        }

.options-content {
    border: 1px solid #e0e0e0;
    border-top: none;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    /* Increased gap */
}

label {
    font-size: 0.9rem;
    color: #555;
    font-weight: bold;
}

input.text-input,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

.text-format-toolbar {
    display: flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px;
    font-size: 17px;
    flex-wrap: wrap;
}

    .text-format-toolbar select {
        border: none;
        width: auto;
        flex-grow: 1;
    }

    .text-format-toolbar input[type="number"] {
        width: 60px;
        text-align: center;
        border: none;
        padding: 0.5rem;
    }

    .text-format-toolbar button {
        border: none;
        background: none;
        cursor: pointer;
        padding: 0.5rem 0.75rem;
        border-radius: 4px;
        font-weight: bold;
    }

        .text-format-toolbar button.active {
            background-color: #e0e0e0;
        }

        .text-format-toolbar button.color-btn {
            text-decoration: underline;
            text-decoration-color: #e5322d;
            text-decoration-thickness: 3px;
        }

        .text-format-toolbar button:nth-of-type(2) {
            font-style: italic;
        }

        .text-format-toolbar button:nth-of-type(3) {
            text-decoration: underline;
        }

.position-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.position-grid {
    display: grid;
    grid-template-columns: repeat(3, 32px);
    grid-template-rows: repeat(3, 32px);
    border: 1px solid #ccc;
}

.grid-cell {
    border: 1px dashed #ddd;
    cursor: pointer;
}

    .grid-cell.selected {
        background-color: #e5322d;
    }

.mosaic-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

    .mosaic-toggle label {
        font-size: 1rem;
        color: #000;
        font-weight: normal;
    }

.option-group-horizontal {
    display: flex;
    gap: 1rem;
}

    .option-group-horizontal > div {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

.info-text {
    font-size: 0.8rem;
    color: #666;
    margin: 0;
}

.theme-btn-blue {
    width: 100%;
    background-color: #e5322d;
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 1.5rem;
    flex-shrink: 0;
    display: block;
    /* Prevent button from shrinking */
}

.mob-theme-btn-blue {
    display: none;
}

    .mob-theme-btn-blue:disabled {
        background-color: #aaa;
    }

.theme-btn-blue:disabled {
    background-color: #aaa;
}

.layer-buttons {
    display: flex;
    gap: 10px;
}

    .layer-buttons button {
        flex: 1;
        padding: 15px;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        background-color: #f7f9fc;
        cursor: pointer;
        font-size: 14px;
        text-align: center;
        color: #666;
        transition: all 0.2s;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 5px;
    }

        .layer-buttons button.selected {
            border: 2px solid #e5322d;
            color: #e5322d;
            font-weight: bold;
            background-color: white;
        }

            .layer-buttons button.selected .icon-wrapper {
                color: #e5322d;
            }

.error-message,
.error-message-inline {
    color: #d9534f;
    font-weight: bold;
    margin-top: 1rem;
    padding: 10px;
    border: 1px solid #d9534f;
    border-radius: 4px;
    background-color: #f2dede;
}

/* Theme with generated by goodle */
.main-container-itp {
    display: flex;
    gap: 24px;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.left-pane-itp {
    flex: 3;
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 440px;
}

.right-pane-itp {
    flex: 1;
    min-width: 300px;
}

.initial-view-itp {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: calc(100vh - 100px);
    padding: 20px;
}

.initial-dropzone-itp {
    border: 2px dashed #e5322d;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s;
    background-color: #f8f9fa;
}

    .initial-dropzone-itp:hover {
        background-color: #e9ecef;
    }

    .initial-dropzone-itp strong {
        font-size: 1.5rem;
        color: #e5322d;
    }

    .initial-dropzone-itp .text-muted {
        font-size: 1rem;
    }

.image-grid-container-itp {
    text-align: center;
    height: 100%;
    padding: 24px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    -ms-flex: 1 1;
    flex: 1 1;
    background-color: #f5f5fa;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    box-shadow: -3px 0 15px rgba(0, 0, 0, 0.2);
    min-height: 450px;
}

.image-thumbnail-grid-itp {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

.image-thumbnail-item-itp {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background-color: #e9ecef;
    cursor: grab;
}

.sortable-ghost {
    opacity: 0.4;
}

.thumbnail-img-itp {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease-in-out;
}

.thumbnail-actions-itp {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    gap: 5px;
}

    .thumbnail-actions-itp button {
        background-color: rgba(0, 0, 0, 0.6);
        color: white;
        border: none;
        border-radius: 50%;
        width: 30px;
        height: 30px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background-color 0.2s;
    }

        .thumbnail-actions-itp button:hover {
            background-color: #dc3545;
        }

        .thumbnail-actions-itp button.rotate-btn:hover {
            background-color: #e5322d;
        }

.progress-overlay-itp {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s;
}

.progress-bar-itp {
    background-color: #e9ecef;
    border-radius: 50px;
    overflow: hidden;
    width: 80%;
    border: 1px solid #ccc;
}

.progress-bar-inner-itp {
    height: 20px;
    line-height: 20px;
    background-color: #28a745;
    color: white;
    text-align: center;
    font-weight: bold;
    transition: width 0.1s;
}

.floating-action-btn-itp {
    position: fixed;
    bottom: 40px;
    right: 380px;
    /* Adjust based on right pane width */
    background-color: #e5322d;
    color: white;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

    .floating-action-btn-itp:hover {
        background-color: #e5322d;
    }

.options-card-itp {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
}

    .options-card-itp h3 {
        margin-top: 0;
        margin-bottom: 24px;
        border-bottom: 1px solid #dee2e6;
        padding-bottom: 12px;
    }

.option-group-itp {
    margin-bottom: 16px;
}

    .option-group-itp label {
        display: block;
        margin-bottom: 8px;
        font-weight: 600;
        color: #495057;
    }

    .option-group-itp select,
    .option-group-itp input {
        width: 100%;
        padding: 10px;
        border: 1px solid #ced4da;
        border-radius: 4px;
        box-sizing: border-box;
    }

.generate-pdf-btn-itp {
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
    background-color: #2f7cff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

    .generate-pdf-btn-itp:hover:not(:disabled) {
        background-color: #218838;
    }

    .generate-pdf-btn-itp:disabled {
        background-color: #6c757d;
        cursor: not-allowed;
    }

.image-grid-container-itp::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.image-grid-container-itp::-webkit-scrollbar-track {
    background: #f0f0f0;
    /* Light track */
    border-radius: 10px;
}

.image-grid-container-itp::-webkit-scrollbar-thumb {
    background-color: #e5322d;
    /* Red thumb */
    border-radius: 0px;
    border: 0px;
    background-clip: content-box;
}

.main-container-itp {
    display: flex;
    gap: 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    position: relative;
    padding-top: 25%;
}

/* Styles for other elements... (all previous styles are kept) */

.floating-action-btn-itp {
    background-color: #e5322d;
    color: white;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    margin-left: auto;
    position: sticky;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 999;
}

    .floating-action-btn-itp:hover {
        background-color: #e5322d;
    }

.settings-toggle-btn-itp {
    /* New settings button */
    display: none;
    /* Hidden on desktop */
    background-color: #e5322d;
    color: white;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    position: sticky;
    top: 92px;
    right: 20px;
    flex-direction: column;
    gap: 12px;
    z-index: 999;
}

.backdrop-itp {
    /* New backdrop */
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1005;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

    .backdrop-itp.visible {
        opacity: 1;
    }

.options-card-header-itp {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 24px;
}

    .options-card-header-itp h3 {
        margin: 0;
        padding-bottom: 12px;
    }

.close-options-btn-itp {
    display: none;
    background: transparent;
    border: none;
    font-size: 2rem;
    line-height: 1;
    padding: 0 10px;
    cursor: pointer;
    color: white;
    background-color: #e5322d;
    color: white;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    margin: -38px 0px 0px -36px;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.6); /* semi-transparent white */
    z-index: 10;
    pointer-events: all; /* block interactions */
    display: none; /* hidden by default */
    cursor: not-allowed;
}
