/* =========================================================
   TEMPLATE RESULT
   PINK PREMIUM - CLEAN & MODERN
   ========================================================= */

:root {
    --pink-dark: #8f174f;
    --pink-900: #a51d5b;
    --pink-800: #bd286b;
    --pink-700: #d9367d;
    --pink-600: #e84a8d;

    --pink-soft: #fff0f6;
    --pink-light: #fff7fa;

    --white: #ffffff;
    --bg: #f8f1f5;

    --text: #3c1728;
    --muted: #8e6f7c;
    --border: #ead6df;

    --shadow: 0 14px 35px rgba(130, 30, 75, 0.10);

    --radius: 18px;
}


/* =========================================================
   RESET
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 28px;

    font-family:
        Inter,
        "Segoe UI",
        Arial,
        Helvetica,
        sans-serif;

    color: var(--text);

    background:
        radial-gradient(
            circle at 5% 0%,
            rgba(217, 54, 125, 0.10),
            transparent 30%
        ),
        radial-gradient(
            circle at 95% 100%,
            rgba(232, 74, 141, 0.08),
            transparent 30%
        ),
        var(--bg);
}


/* =========================================================
   MAIN CONTAINER
   ========================================================= */

.app {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 18px;

    background: rgba(255, 255, 255, 0.96);

    border: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: 24px;

    box-shadow:
        0 25px 70px rgba(112, 23, 61, 0.13);
}


/* =========================================================
   HEADER
   ========================================================= */

.top-title {
    position: relative;

    min-height: 92px;

    overflow: hidden;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 17px;

    color: #ffffff;

    background:
        linear-gradient(
            120deg,
            #72133f 0%,
            #9f1c58 50%,
            #c62b70 100%
        );

    box-shadow:
        0 9px 24px rgba(128, 24, 69, 0.20);

    font-size: 28px;
    font-weight: 900;

    letter-spacing: 1.5px;
}


/* Dekorasi header */

.top-title::before,
.top-title::after {
    content: "";

    position: absolute;

    width: 170px;
    height: 170px;

    border: 2px solid rgba(255, 255, 255, 0.13);

    transform: rotate(45deg);

    pointer-events: none;
}

.top-title::before {
    left: -115px;
    top: -105px;
}

.top-title::after {
    right: -115px;
    bottom: -105px;
}


/* =========================================================
   WORKSPACE
   ========================================================= */

.workspace {
    display: grid;

    grid-template-columns:
        300px
        minmax(0, 1fr);

    gap: 20px;

    align-items: stretch;

    margin-top: 20px;
}


/* =========================================================
   CONTROL PANEL
   ========================================================= */

.control-panel {
    display: flex;
    flex-direction: column;

    gap: 11px;

    padding: 18px;

    background: #ffffff;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    box-shadow: var(--shadow);
}


/* Label */

.control-panel label {
    margin-top: 3px;

    color: var(--pink-dark);

    font-size: 12px;
    font-weight: 800;

    letter-spacing: 0.7px;
}


/* Input */

.control-panel input {
    width: 100%;
    height: 48px;

    padding: 0 14px;

    border: 1.5px solid #dfc8d2;
    border-radius: 11px;

    outline: none;

    color: var(--text);

    background: #fffafd;

    font-size: 14px;
    font-weight: 600;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}


/* Placeholder */

.control-panel input::placeholder {
    color: #aa929d;
}


/* Hover */

.control-panel input:hover {
    border-color: #cf9db1;
}


/* Focus */

.control-panel input:focus {
    border-color: var(--pink-700);

    background: #ffffff;

    box-shadow:
        0 0 0 4px rgba(217, 54, 125, 0.10);
}


/* =========================================================
   DOWNLOAD BUTTON
   ========================================================= */

.download-btn {
    position: relative;

    width: 100%;
    min-height: 53px;

    margin-top: 7px;

    border: none;
    border-radius: 12px;

    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            var(--pink-dark),
            var(--pink-700)
        );

    font-size: 13px;
    font-weight: 900;

    letter-spacing: 0.7px;

    cursor: pointer;

    box-shadow:
        0 8px 18px rgba(165, 29, 91, 0.20);

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease;
}


/* Icon download */

.download-btn::after {
    content: "↓";

    margin-left: 10px;

    color: #ffd6e7;

    font-size: 19px;

    vertical-align: -1px;
}


/* Hover */

.download-btn:hover {
    transform: translateY(-2px);

    box-shadow:
        0 12px 25px rgba(165, 29, 91, 0.27);
}


/* Active */

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


/* =========================================================
   PREVIEW
   ========================================================= */

.preview-panel {
    min-width: 0;
}


.preview-wrap {
    position: relative;

    width: min(100%, 600px);

    aspect-ratio: 1 / 1;

    margin: 0 auto;

    overflow: hidden;

    border: 2px solid #e3c6d3;

    border-radius: 18px;

    background:
        linear-gradient(
            145deg,
            #ffffff,
            #fff5f9
        );

    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.9),
        var(--shadow);
}


/* Garis dekorasi preview */

.preview-wrap::before {
    content: "";

    position: absolute;

    inset: 10px;

    border: 1px dashed #e6cbd6;

    border-radius: 12px;

    pointer-events: none;
}


/* Canvas */

#resultCanvas {
    position: relative;

    z-index: 2;

    width: 100%;
    height: 100%;

    display: none;
}


/* Empty preview */

.empty-preview {
    position: absolute;

    inset: 0;

    z-index: 1;

    display: flex;

    align-items: center;
    justify-content: center;

    flex-direction: column;

    color: var(--pink-dark);

    text-align: center;

    font-size: 16px;
    font-weight: 900;

    letter-spacing: 0.7px;
}


/* Icon preview */

.empty-preview::before {
    content: "▣";

    display: flex;

    align-items: center;
    justify-content: center;

    width: 58px;
    height: 58px;

    margin-bottom: 15px;

    border: 2px solid var(--pink-700);

    border-radius: 14px;

    color: var(--pink-700);

    font-size: 27px;
}


/* =========================================================
   TEMPLATE BUTTON
   ========================================================= */

.template-grid {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 13px;

    margin-top: 20px;
}


/* Button */

.template-btn {
    position: relative;

    min-height: 54px;

    overflow: hidden;

    padding: 0 18px;

    border: 1px solid #e2cbd5;

    border-radius: 13px;

    display: flex;

    align-items: center;

    justify-content: flex-start;

    color: var(--pink-dark);

    background: #ffffff;

    font-size: 12px;

    font-weight: 900;

    letter-spacing: 0.35px;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}


/* Garis pink kiri */

.template-btn::before {
    content: "";

    width: 5px;
    height: 27px;

    margin-right: 12px;

    border-radius: 10px;

    background: var(--pink-700);

    transition:
        background 0.2s ease,
        height 0.2s ease;
}


/* Arrow */

.template-btn::after {
    content: "›";

    position: absolute;

    right: 17px;

    color: var(--pink-700);

    font-size: 24px;

    font-weight: 400;

    transition:
        right 0.2s ease,
        color 0.2s ease;
}


/* =========================================================
   TEMPLATE HOVER
   ========================================================= */

.template-btn:hover {
    transform: translateY(-2px);

    border-color: var(--pink-600);

    box-shadow:
        0 9px 22px rgba(130, 30, 75, 0.10);

    background: #fffafd;
}


.template-btn:hover::before {
    height: 32px;

    background: var(--pink-600);
}


.template-btn:hover::after {
    right: 13px;

    color: var(--pink-dark);
}


/* =========================================================
   TEMPLATE ACTIVE
   ========================================================= */

.template-btn.active {
    border-color: var(--pink-dark);

    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            var(--pink-dark),
            var(--pink-700)
        );

    box-shadow:
        0 9px 22px rgba(130, 30, 75, 0.18);
}


.template-btn.active::before {
    height: 32px;

    background: #ffd3e4;
}


.template-btn.active::after {
    color: #ffd3e4;
}


/* =========================================================
   SCROLLBAR
   ========================================================= */

::-webkit-scrollbar {
    width: 9px;
}

::-webkit-scrollbar-track {
    background: #f9eef3;
}

::-webkit-scrollbar-thumb {
    border-radius: 20px;

    background: #d78ba8;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--pink-700);
}


/* =========================================================
   RESPONSIVE - TABLET
   ========================================================= */

@media (max-width: 900px) {

    body {
        padding: 16px;
    }

    .workspace {
        grid-template-columns:
            250px
            minmax(0, 1fr);
    }

    .template-grid {
        grid-template-columns:
            repeat(2, 1fr);
    }
}


/* =========================================================
   RESPONSIVE - MOBILE
   ========================================================= */

@media (max-width: 680px) {

    body {
        padding: 10px;
    }

    .app {
        padding: 11px;

        border-radius: 18px;
    }

    .top-title {
        min-height: 76px;

        font-size: 21px;

        letter-spacing: 1px;
    }

    .workspace {
        grid-template-columns: 1fr;
    }

    .preview-panel {
        order: 1;
    }

    .control-panel {
        order: 2;
    }

    .template-grid {
        order: 3;

        grid-template-columns:
            1fr 1fr;
    }
}


/* =========================================================
   RESPONSIVE - SMALL PHONE
   ========================================================= */

@media (max-width: 430px) {

    .template-grid {
        grid-template-columns: 1fr;
    }

    .top-title {
        font-size: 18px;
    }

    .control-panel {
        padding: 14px;
    }

    .template-btn {
        min-height: 50px;
    }
}