/* WriteNamePics - Stylesheet matching GetText & ChangeBackground Theme */

main {
    width: 96%;
    max-width: 1360px;
    margin: 0 auto;
}

.container {
    width: 100% !important;
    max-width: 1360px;
    box-sizing: border-box;
    padding: 24px 28px;
}

/* 2-Column Side-by-Side Editor Workspace */
.editor-workspace {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
    width: 100%;
}

.editor-controls-col {
    flex: 1 1 560px;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.editor-controls-col .controls-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px 16px;
    width: 100%;
    margin-bottom: 16px;
}

.editor-preview-col {
    flex: 1 1 480px;
    min-width: 320px;
    position: sticky;
    top: 20px;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
}

.editor-preview-col .canvas-container {
    width: 100%;
    text-align: center;
}

.editor-preview-col .canvas-wrapper {
    width: 100%;
    max-width: 520px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    box-sizing: border-box;
}

.editor-preview-col #imageCanvas {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: calc(100vh - 210px);
    object-fit: contain;
    display: block;
}

.editor-preview-col .action-buttons .btn {
    padding: 10px 18px;
    font-size: 14px;
}

/* Checkered Background for Transparency Visual matching ChangeBackground */
.canvas-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    background-image: linear-gradient(45deg, #ddd 25%, transparent 25%),
                      linear-gradient(-45deg, #ddd 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #ddd 75%),
                      linear-gradient(-45deg, transparent 75%, #ddd 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #fcfcfc;
    border: 2px dashed #aaa;
    border-radius: 8px;
    padding: 10px;
    box-sizing: border-box;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
}

#imageCanvas {
    max-width: 100%;
    height: auto;
    border: 2px solid #ddd;
    border-radius: 8px;
    margin-bottom: 0;
    cursor: grab;
    display: block;
}

#imageCanvas:active {
    cursor: grabbing;
}

/* Presets Container Styling matching ChangeBackground */
.presets-container {
    width: 100%;
    margin-bottom: 15px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
    background-color: #f8f9fa;
    padding: 12px 18px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    box-sizing: border-box;
}

.preset-label {
    font-weight: 600;
    font-size: 14px;
    color: #495057;
    white-space: nowrap;
}

.preset-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.preset-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #ced4da;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.preset-btn:hover {
    transform: scale(1.15);
    border-color: #4a90e2;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.preset-btn.active {
    border-color: #0d47a1;
    transform: scale(1.1);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.35);
}

/* Template Strip Gallery */
.template-strip-container {
    width: 100%;
    margin-bottom: 20px;
    background-color: #f8f9fa;
    padding: 12px 18px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    box-sizing: border-box;
}

.template-strip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.template-strip {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
}

.template-strip::-webkit-scrollbar {
    height: 6px;
}

.template-strip::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.template-card {
    flex: 0 0 110px;
    border: 2px solid #ced4da;
    border-radius: 6px;
    background: #ffffff;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s ease;
    text-align: center;
    padding: 3px;
}

.template-card:hover {
    border-color: #4a90e2;
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.template-card.active {
    border-color: #0d47a1;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.4);
}

.template-thumb {
    width: 100%;
    height: 65px;
    border-radius: 4px;
    display: block;
    object-fit: cover;
}

.template-name {
    font-size: 11px;
    font-weight: 600;
    color: #495057;
    padding: 4px 2px 2px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Button & Picker Button Styles matching ChangeBackground */
.picker-btn {
    background-color: #f8f9fa;
    color: #495057;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 8px 14px;
    font-weight: 500;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    box-sizing: border-box;
}

.picker-btn:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.picker-btn.active {
    background-color: #e3f2fd;
    color: #0d47a1;
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.25);
}

/* Show more / less toggles matching AddText */
.show-more-adctrl {
    display: flex !important;
}

.show-less-adctrl {
    display: none !important;
}

/* Header link adjustment matching commonStyle.css */
#mainContentHeader {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: 25px;
}

#mainContentHeader a {
    position: absolute;
    left: 0;
    color: #4a90e2;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#mainContentHeader h2 {
    margin: 0;
    color: #4a90e2;
    text-align: center;
    font-size: 24px;
}

/* Toast message matching theme */
.wnp-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #212529;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 9999;
    animation: toastFadeInOut 3s forwards;
}

@keyframes toastFadeInOut {
    0% { opacity: 0; transform: translateY(12px); }
    15% { opacity: 1; transform: translateY(0); }
    85% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-8px); }
}

@media (max-width: 960px) {
    main {
        width: 100%;
    }

    .editor-workspace {
        flex-direction: column;
    }

    .editor-preview-col {
        position: static;
        width: 100%;
        order: -1; /* Place canvas at the top on smaller screens */
        margin-bottom: 20px;
    }

    .editor-controls-col {
        width: 100%;
    }

    .editor-preview-col .canvas-wrapper {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 16px 14px;
    }

    #mainContentHeader {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    #mainContentHeader a {
        position: static;
        width: 100%;
        text-align: left;
    }

    #mainContentHeader h2 {
        width: 100%;
        text-align: center;
    }

    .editor-controls-col .controls-container {
        grid-template-columns: 1fr;
    }
}
