* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 40px;
    background: #f4f6f8;
    font-family: "Segoe UI", Arial, sans-serif;
    color: #333;
}

.container {
    max-width: 1100px;
    margin: auto;
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, .15);
}

h1 {
    margin-top: 0;
    color: #1976d2;
}

p {
    color: #666;
}

[hidden] {
    display: none !important;
}


/* =========================================
   TEXT AREAS & INPUTS
========================================= */

textarea {
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 6px;
    resize: vertical;
    padding: 12px;
    font-size: 14px;
    font-family: Consolas, monospace;
    outline: none;
}

textarea:focus,
.textInput:focus,
select:focus {
    border-color: #2196F3;
}

#urls {
    height: 320px;
}

.failedBox {
    height: 120px;
    background: #fafafa;
}

.templateUrlTextarea {
    min-height: 260px;
    line-height: 1.5;
    padding: 14px;
}

.textInput {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 15px;
    outline: none;
}

select {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
}


/* =========================================
   BUTTONS
========================================= */

.buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    transition: .2s;
    background: #e0e0e0;
    color: #333;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
}

button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

#downloadBtn,
#templateDownloadBtn,
.blueBtn {
    background: #2196F3;
    color: #fff;
}

#downloadBtn:hover:not(:disabled),
#templateDownloadBtn:hover:not(:disabled),
.blueBtn:hover:not(:disabled) {
    background: #1976D2;
}

#clearBtn,
#templateClearBtn,
.dangerBtn {
    background: #f44336;
    color: #fff;
}

#clearBtn:hover:not(:disabled),
#templateClearBtn:hover:not(:disabled),
.dangerBtn:hover:not(:disabled) {
    background: #d32f2f;
}

#pasteBtn,
#templatePasteBtn {
    background: #43A047;
    color: #fff;
}

#pasteBtn:hover:not(:disabled),
#templatePasteBtn:hover:not(:disabled) {
    background: #2E7D32;
}

#templatePreviewBtn {
    background: #795548;
    color: #fff;
}

.greyBtn {
    background: #607D8B;
    color: #fff;
}

.greyBtn:hover:not(:disabled) {
    background: #455A64;
}

#copyFailed,
#templateCopyFailed {
    margin-top: 10px;
}


/* =========================================
   OPTIONS
========================================= */

.options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 25px;
    margin: 20px 0;
    font-size: 15px;
}

.inlineSelect select {
    margin-left: 8px;
}

label {
    cursor: pointer;
}

input[type=checkbox] {
    transform: scale(1.2);
    margin-right: 8px;
}


/* =========================================
   PROGRESS
========================================= */

.progress {
    margin-top: 30px;
}

.progressHeader {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 10px;
    font-weight: bold;
}

.progressBar {
    width: 100%;
    height: 28px;
    background: #ddd;
    border-radius: 20px;
    overflow: hidden;
}

#progressFill,
#templateProgressFill {
    width: 0%;
    height: 100%;
    transition: width .25s;
}

#progressFill {
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
}

#templateProgressFill {
    background: linear-gradient(90deg, #2196F3, #03A9F4);
}

.statusText {
    margin-top: 12px;
    font-size: 15px;
    color: #555;
    white-space: pre-line;
}

.statusText.error {
    color: #c62828;
}

.statusText.ok {
    color: #2E7D32;
}

.failedContainer {
    margin-top: 35px;
}


/* =========================================
   TABS
========================================= */

.tabs {
    display: flex;
    gap: 5px;
    margin: 25px 0;
    border-bottom: 1px solid #ddd;
}

.tabButton {
    background: #eee;
    color: #333;
    border-radius: 6px 6px 0 0;
    padding: 13px 25px;
    font-weight: 600;
}

.tabButton:hover:not(:disabled) {
    transform: none;
    background: #ddd;
}

.tabButton.active,
.tabButton.active:hover:not(:disabled) {
    background: #2196F3;
    color: #fff;
}

.tabContent {
    display: none;
}

.tabContent.active {
    display: block;
}


/* =========================================
   EBAY TEMPLATE
========================================= */

.brandSelector {
    margin: 20px 0;
    max-width: 400px;
}

.brandSelector label {
    display: block;
    font-weight: 600;
    margin-bottom: 7px;
}

#brandSelect {
    width: 100%;
    padding: 11px 12px;
    font-size: 15px;
}

.modeSelector {
    margin-top: 20px;
    max-width: 600px;
}

.modeSelector label {
    display: block;
    font-weight: 600;
    margin-bottom: 7px;
}

.modeSelector select {
    width: 100%;
    padding: 11px 12px;
    font-size: 15px;
}

.templateOptions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.optionBox {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px 16px;
    background: #fafafa;
    min-width: 160px;
}

.optionBox label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
}

.optionBox .checkLabel {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #333;
    font-weight: bold;
    margin: 0;
}

.dimensionText {
    font-weight: bold;
}

.templatePreviewContainer {
    margin-top: 30px;
}

.previewImageWrapper {
    width: 100%;
    max-width: 650px;
    margin: auto;
    background: #eee;
    padding: 10px;
    border-radius: 8px;
}

#templatePreview {
    display: block;
    width: 100%;
    height: auto;
    background: #fff;
}

.previewControls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.previewControls button {
    padding: 10px 20px;
    background: #2196F3;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

.previewControls button:hover:not(:disabled) {
    background: #1976D2;
}

#templatePreviewCounter {
    min-width: 70px;
    text-align: center;
    font-weight: 600;
}


/* =========================================
   BRAND LOGOS TAB
========================================= */

.settingsToolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 10px 0 15px;
    font-weight: 600;
}

.settingsToolbar button {
    padding: 8px 16px;
    font-size: 14px;
}

.brandGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.brandCard {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.brandCard .logoBox {
    aspect-ratio: 1 / 1;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.brandCard .logoBox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.brandCard .brandTitle {
    font-weight: 600;
}

.brandCard .brandFile {
    font-size: 12px;
    color: #888;
    word-break: break-all;
}

.brandCard button {
    padding: 7px 12px;
    font-size: 13px;
}

.ownerPanel {
    margin-top: 35px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px 16px;
    background: #fcfcfc;
}

.ownerPanel summary {
    cursor: pointer;
    font-weight: 600;
    color: #555;
}

.ownerPanel[open] summary {
    margin-bottom: 12px;
}

.ownerBadge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: #e8f5e9;
    border-radius: 6px;
}

.ownerBadge button {
    padding: 7px 14px;
    font-size: 13px;
}

.formRow {
    margin: 14px 0;
    max-width: 500px;
}

.formRow label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

.brandFilePreview {
    display: block;
    max-width: 250px;
    max-height: 250px;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 6px;
    background: #fff;
}

.smallText {
    font-size: 13px;
    color: #666;
    display: block;
    margin: 8px 0;
}


/* =========================================
   MOBILE
========================================= */

@media (max-width: 700px) {

    body {
        padding: 15px;
    }

    .container {
        padding: 20px;
    }

    .buttons {
        flex-direction: column;
    }

    .buttons button {
        width: 100%;
    }

    .progressHeader {
        gap: 10px;
        flex-direction: column;
    }

    .tabs {
        flex-direction: column;
        border: none;
    }

    .tabButton {
        width: 100%;
        border-radius: 6px;
    }

    .templateOptions {
        flex-direction: column;
    }

    .optionBox {
        width: 100%;
    }

    .previewControls {
        gap: 10px;
    }

    .previewControls button {
        padding: 9px 12px;
    }

    .templateUrlTextarea {
        min-height: 300px;
    }
}


/* =========================================
   SIZE SLIDERS
========================================= */

.sizeSliders {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 15px 30px;
    margin-top: 15px;
    padding: 14px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fafafa;
}

.sliderRow {
    flex: 1 1 240px;
}

.sliderRow label {
    display: block;
    font-size: 14px;
    margin-bottom: 6px;
}

.sliderRow input[type=range] {
    width: 100%;
    accent-color: #2196F3;
}

.sliderRow input[type=range]:disabled {
    opacity: .4;
}

.inlineNote {
    display: inline;
    margin: 0;
}

.sizeSliders button {
    padding: 8px 16px;
    font-size: 14px;
}

@media (max-width: 700px) {
    .sizeSliders button {
        width: 100%;
    }
}


/* =========================================
   LOADING / PROGRESS
========================================= */

.previewImageWrapper {
    position: relative;
}

.previewLoading {
    position: absolute;
    inset: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: rgba(255, 255, 255, .82);
    border-radius: 4px;
    font-weight: 600;
    color: #333;
    text-align: center;
    padding: 20px;
}

.previewLoading[hidden] {
    display: none;
}

.spinner {
    width: 46px;
    height: 46px;
    border: 5px solid #cfe3f7;
    border-top-color: #2196F3;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

.miniBar {
    width: 70%;
    max-width: 320px;
    height: 10px;
    background: #ddd;
    border-radius: 10px;
    overflow: hidden;
}

#previewLoadingFill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #2196F3, #03A9F4);
    transition: width .2s;
}

#previewLoadingFill.indeterminate {
    width: 35% !important;
    animation: slide 1.1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(300%); }
}

button.working {
    cursor: progress;
}

.appVersion {
    margin-top: 25px;
    font-size: 12px;
    color: #aaa;
    text-align: right;
}


/* =========================================
   24-HOUR LINKS
========================================= */

.linkBtn {
    background: #6A1B9A;
    color: #fff;
}

.linkBtn:hover:not(:disabled) {
    background: #4A148C;
}

.linksBox {
    margin-top: 25px;
    padding: 15px 18px;
    border: 2px solid #CE93D8;
    border-radius: 8px;
    background: #FBF5FD;
}

.linksBox h3 {
    margin-top: 0;
}

.linksOutput {
    height: 140px;
    background: #fff;
    margin-bottom: 10px;
}
