/* =========================================================
   IMAGE WATERMARK
   ========================================================= */

.watermark-page {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 20px 60px;
    box-sizing: border-box;
}


/* =========================================================
   HEADER
   ========================================================= */

.watermark-header {
    margin-bottom: 28px;
}

.watermark-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border: 1px solid #d9dee7;
    border-radius: 6px;
    background: #f8fafc;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
}

.watermark-header h1 {
    margin: 10px 0 8px;
    color: #172033;
    font-size: 34px;
    line-height: 1.2;
    font-weight: 700;
}

.watermark-header p {
    max-width: 700px;
    margin: 0;
    color: #687386;
    font-size: 15px;
    line-height: 1.7;
}


/* =========================================================
   CARD
   ========================================================= */

.watermark-card {
    margin-bottom: 22px;
    padding: 26px;
    border: 1px solid #e5e9ef;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 5px 20px rgba(15, 23, 42, .045);
}

.watermark-section-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.watermark-section-title h2 {
    margin: 0 0 5px;
    color: #182033;
    font-size: 20px;
    font-weight: 700;
}

.watermark-section-title p {
    margin: 0;
    color: #7a8494;
    font-size: 13px;
    line-height: 1.5;
}


/* =========================================================
   UPLOAD
   ========================================================= */

.watermark-upload {
    min-height: 230px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    box-sizing: border-box;
    border: 1.5px dashed #cbd3df;
    border-radius: 12px;
    background: #fafbfc;
    text-align: center;
    cursor: pointer;
    transition:
        border-color .2s ease,
        background .2s ease,
        transform .2s ease;
}

.watermark-upload:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.watermark-upload.dragover {
    border-color: #64748b;
    background: #f1f5f9;
    transform: translateY(-1px);
}

.watermark-upload-icon {
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    border-radius: 12px;
    background: #eef2f7;
    color: #475569;
    font-size: 28px;
    font-weight: 600;
}

.watermark-upload h3 {
    margin: 0 0 7px;
    color: #263044;
    font-size: 17px;
    font-weight: 650;
}

.watermark-upload p {
    margin: 0 0 8px;
    color: #7b8493;
    font-size: 13px;
}

.watermark-browse {
    padding: 0;
    border: 0;
    background: transparent;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

.watermark-upload-note {
    color: #a0a8b5;
    font-size: 11px;
}


/* =========================================================
   FILE INFO
   ========================================================= */

.watermark-file-info {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 20px;
    padding: 14px;
    border: 1px solid #e5e9ef;
    border-radius: 10px;
    background: #fbfcfd;
}

.watermark-file-preview {
    width: 84px;
    height: 70px;
    flex: 0 0 84px;
    overflow: hidden;
    border-radius: 8px;
    background: #eef1f5;
}

.watermark-file-preview img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.watermark-file-details {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.watermark-file-details div {
    min-width: 0;
}

.watermark-file-details span {
    display: block;
    margin-bottom: 4px;
    color: #8a93a2;
    font-size: 11px;
}

.watermark-file-details strong {
    display: block;
    overflow: hidden;
    color: #263044;
    font-size: 13px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-ready {
    color: #28734a !important;
}


/* =========================================================
   SETTINGS
   ========================================================= */

.watermark-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.watermark-control {
    min-width: 0;
}

.watermark-control-full {
    grid-column: 1 / -1;
}

.watermark-control > label {
    display: block;
    margin-bottom: 8px;
    color: #30394a;
    font-size: 13px;
    font-weight: 650;
}

.watermark-control small {
    display: block;
    margin-top: 6px;
    color: #929aa8;
    font-size: 11px;
}

.watermark-input {
    width: 100%;
    height: 44px;
    padding: 0 13px;
    box-sizing: border-box;
    border: 1px solid #dce1e8;
    border-radius: 8px;
    outline: none;
    background: #ffffff;
    color: #273044;
    font-family: inherit;
    font-size: 13px;
    transition:
        border-color .2s ease,
        box-shadow .2s ease;
}

.watermark-input:focus {
    border-color: #94a3b8;
    box-shadow: 0 0 0 3px rgba(100, 116, 139, .08);
}


/* =========================================================
   RANGE CONTROLS
   ========================================================= */

.range-control {
    display: flex;
    align-items: center;
    gap: 13px;
    height: 44px;
}

.range-control input[type="range"] {
    width: 100%;
    height: 5px;
    margin: 0;
    accent-color: #475569;
    cursor: pointer;
}

.range-control span {
    min-width: 55px;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    text-align: right;
}


/* =========================================================
   POSITION GRID
   ========================================================= */

.position-grid {
    width: 150px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}

.position-button {
    width: 46px;
    height: 38px;
    border: 1px solid #dce1e8;
    border-radius: 7px;
    background: #ffffff;
    color: #687386;
    font-size: 17px;
    cursor: pointer;
    transition:
        border-color .2s ease,
        background .2s ease,
        color .2s ease;
}

.position-button:hover {
    border-color: #aab4c2;
    background: #f8fafc;
}

.position-button.active {
    border-color: #475569;
    background: #475569;
    color: #ffffff;
}


/* =========================================================
   COLOR
   ========================================================= */

.color-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-control input[type="color"] {
    width: 44px;
    height: 44px;
    padding: 3px;
    border: 1px solid #dce1e8;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
}

.color-control .watermark-input {
    flex: 1;
}


/* =========================================================
   PREVIEW
   ========================================================= */

.watermark-preview-section {
    grid-column: 1 / -1;
    margin-top: 4px;
    padding-top: 22px;
    border-top: 1px solid #edf0f4;
}

.watermark-preview-header {
    margin-bottom: 14px;
}

.watermark-preview-header h3 {
    margin: 0 0 4px;
    color: #30394a;
    font-size: 15px;
    font-weight: 700;
}

.watermark-preview-header p {
    margin: 0;
    color: #929aa8;
    font-size: 12px;
}

.watermark-preview-canvas {
    position: relative;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 20px;
    box-sizing: border-box;
    border: 1px solid #e1e6ed;
    border-radius: 10px;
    background:
        linear-gradient(45deg, #f3f4f6 25%, transparent 25%),
        linear-gradient(-45deg, #f3f4f6 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f3f4f6 75%),
        linear-gradient(-45deg, transparent 75%, #f3f4f6 75%);
    background-size: 22px 22px;
    background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}

.watermark-preview-canvas img {
    max-width: 100%;
    max-height: 460px;
    display: block;
    object-fit: contain;
    border-radius: 3px;
    box-shadow: 0 5px 18px rgba(15, 23, 42, .12);
}

.watermark-preview-text {
    position: absolute;
    max-width: 80%;
    padding: 3px 8px;
    color: #ffffff;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    text-shadow:
        1px 1px 2px rgba(0, 0, 0, .55),
        -1px -1px 1px rgba(0, 0, 0, .15);
    transform: translate(-50%, -50%);
}


/* =========================================================
   ACTIONS
   ========================================================= */

.watermark-action {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 26px;
    padding-top: 22px;
    border-top: 1px solid #edf0f4;
}

.watermark-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 18px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    transition:
        background .2s ease,
        border-color .2s ease,
        transform .2s ease;
}

.watermark-button:hover {
    transform: translateY(-1px);
}

.watermark-button.primary {
    border: 0;
    background: var(--gp-gradient);
    color: #ffffff;
}

.watermark-button.primary:hover {
    background: var(--gp-gradient-hover);
    border-color: transparent;
}

.watermark-button.secondary {
    border: 1px solid #d7dde5;
    background: #ffffff;
    color: #475569;
}

.watermark-button.secondary:hover {
    background: #f8fafc;
    border-color: #bfc7d2;
}

.watermark-loading {
    font-size: 12px;
}


/* =========================================================
   RESULT
   ========================================================= */

.watermark-result-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
    gap: 26px;
    align-items: start;
}

.watermark-result-preview {
    min-height: 330px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    border: 1px solid #e3e7ed;
    border-radius: 10px;
    background: #f7f8fa;
}

.watermark-result-preview img {
    max-width: 100%;
    max-height: 500px;
    display: block;
    object-fit: contain;
}

.watermark-result-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.result-detail {
    min-width: 0;
    padding: 12px;
    border: 1px solid #e8ebf0;
    border-radius: 8px;
    background: #fbfcfd;
}

.result-detail span {
    display: block;
    margin-bottom: 5px;
    color: #8992a0;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.result-detail strong {
    display: block;
    overflow: hidden;
    color: #30394a;
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.watermark-result-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-top: 6px;
}


/* =========================================================
   ERROR
   ========================================================= */

.watermark-error {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 22px;
    padding: 15px 17px;
    border: 1px solid #eadede;
    border-radius: 10px;
    background: #fdfafa;
}

.watermark-error-icon {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f3e7e7;
    color: #a14b4b;
    font-weight: 700;
}

.watermark-error strong {
    display: block;
    margin-bottom: 3px;
    color: #713b3b;
    font-size: 13px;
}

.watermark-error p {
    margin: 0;
    color: #8a5a5a;
    font-size: 12px;
    line-height: 1.5;
}


/* =========================================================
   INFO CARDS
   ========================================================= */

.watermark-info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.watermark-info-card {
    padding: 20px;
    border: 1px solid #e6e9ee;
    border-radius: 11px;
    background: #ffffff;
}

.info-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    border-radius: 8px;
    background: #f1f4f7;
    color: #475569;
    font-size: 15px;
    font-weight: 700;
}

.watermark-info-card h3 {
    margin: 0 0 6px;
    color: #30394a;
    font-size: 14px;
    font-weight: 700;
}

.watermark-info-card p {
    margin: 0;
    color: #858e9d;
    font-size: 12px;
    line-height: 1.6;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 900px) {

    .watermark-file-details {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .watermark-result-grid {
        grid-template-columns: 1fr;
    }

    .watermark-info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


@media (max-width: 680px) {

    .watermark-page {
        padding: 22px 14px 40px;
    }

    .watermark-card {
        padding: 18px;
    }

    .watermark-header h1 {
        font-size: 28px;
    }

    .watermark-settings-grid {
        grid-template-columns: 1fr;
    }

    .watermark-control-full,
    .watermark-preview-section {
        grid-column: auto;
    }

    .watermark-file-info {
        align-items: flex-start;
    }

    .watermark-file-details {
        grid-template-columns: 1fr;
    }

    .watermark-preview-canvas {
        min-height: 240px;
    }

    .watermark-result-details {
        grid-template-columns: 1fr;
    }

    .watermark-result-actions {
        grid-column: auto;
    }

    .watermark-info-grid {
        grid-template-columns: 1fr;
    }

    .watermark-action {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .watermark-button {
        width: 100%;
    }
}


@media (max-width: 420px) {

    .watermark-upload {
        min-height: 200px;
        padding: 22px 15px;
    }

    .watermark-file-preview {
        width: 65px;
        height: 58px;
        flex-basis: 65px;
    }

    .position-grid {
        width: 100%;
    }

    .position-button {
        width: 100%;
    }
}


/* The HTML "hidden" attribute must win over the display rules above,
   otherwise sections meant to stay hidden can show up at once. */
[hidden] {
    display: none !important;
}
