/* =========================================
   JOY NAIL MAKER
   Main UI Styles
========================================= */

:root {
    --primary: #8c00e6;
    --primary-dark: #6800bd;
    --primary-light: #f2e5ff;

    --surface: #ffffff;
    --surface-soft: #fafafa;

    --border: #dddddd;

    --text: #181818;
    --muted: #777777;

    --shadow:
        0 18px 45px rgba(28, 0, 55, 0.25);

    --radius-lg: 24px;
    --radius-md: 12px;
    --radius-sm: 8px;
}


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

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "Inter", Arial, sans-serif;
    color: var(--text);
    background: url("../assets/images/bg-gradient.webp");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}


/* =========================================
   APPLICATION
========================================= */

.app-page {
    min-height: 100vh;

    display: flex;
    flex-direction: column;
    align-items: center;

    padding: 34px 24px 22px;
}


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

.brand-header {
    width: min(1100px, 100%);

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

    margin-bottom: 28px;
}

.brand-logo {
    width: 245px;
    max-width: 70%;
    height: auto;
    object-fit: contain;
}


/* =========================================
   EDITOR SHELL
========================================= */

.editor-shell {
    width: min(1100px, 100%);

    background: var(--surface);

    border-radius: var(--radius-lg);

    padding: 32px;

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


/* =========================================
   TOP EDITOR MENU
========================================= */

.editor-menu {
    width: 100%;

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

    gap: 14px;

    padding: 14px;

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

    background: #ffffff;

    margin-bottom: 28px;
}

.menu-item {
    border: 0;

    min-height: 48px;

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

    gap: 9px;

    padding: 10px 16px;

    border-radius: 999px;

    background: #f4f4f4;

    color: var(--text);

    font-size: 15px;
    font-weight: 500;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.menu-item svg {
    width: 22px;
    height: 22px;

    color: var(--primary);
    stroke-width: 1.8;
}

.menu-item:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.menu-item.active {
    background: var(--primary);
    color: #ffffff;
}

.menu-item.active svg {
    color: #ffffff;
}


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

.editor-workspace {
    display: grid;

    grid-template-columns:
        minmax(250px, 0.72fr)
        minmax(0, 1.38fr);

    gap: 26px;
}


/* =========================================
   TOOL PANEL
========================================= */

.tool-panel {
    height: 590px;
    min-height: 0;

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

    background: var(--surface-soft);

    overflow: hidden;
}

.tool-panel-content {
    width: 100%;
    height: 100%;

    min-height: 0;

    padding: 22px;

    display: flex;
    flex-direction: column;
}


/* =========================================
   CANVAS PANEL
========================================= */

.canvas-panel {
    position: relative;

    min-width: 0;
    height: 590px;
    min-height: 0;

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

    background: var(--surface-soft);

    overflow: hidden;
}


/* Placeholder where Fabric.js will go */

.canvas-placeholder {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;

    overflow: hidden;
}


/*
 * Fabric.js creates its own wrapper.
 */
.canvas-placeholder .canvas-container {
    width: 100% !important;
    height: 100% !important;
}


/*
 * Keep Fabric canvases aligned
 * with our editor workspace.
 */
.canvas-placeholder canvas {
    display: block;
}


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

.circle-action {
    width: 42px;
    height: 42px;

    border: 0;
    border-radius: 50%;

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

    background: var(--primary);

    color: #ffffff;

    cursor: pointer;

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

.circle-action svg {
    width: 19px;
    height: 19px;
}

.circle-action:hover {
    background: var(--primary-dark);

    transform: translateY(-2px);

    box-shadow:
        0 6px 15px rgba(104, 0, 189, 0.25);
}


/* =========================================
   ZOOM CONTROLS
========================================= */
.zoom-controls,
.canvas-actions {
    z-index: 20;
}

.zoom-controls {
    position: absolute;

    right: 22px;
    top: 50%;

    transform: translateY(-50%);

    display: flex;
    flex-direction: column;

    gap: 9px;

    padding: 7px;

    background: #ffffff;

    border-radius: 999px;

    box-shadow:
        0 6px 14px rgba(0, 0, 0, 0.10);
}


/* =========================================
   BOTTOM CANVAS ACTIONS
========================================= */

.canvas-actions {
    position: absolute;

    left: 50%;
    bottom: 24px;

    transform: translateX(-50%);

    display: flex;
    align-items: center;

    gap: 9px;

    padding: 8px 12px;

    border-radius: 999px;

    background: #ffffff;

    box-shadow:
        0 7px 20px rgba(0, 0, 0, 0.13);
}


/* =========================================
   FOOTER
========================================= */

.app-footer {
    margin-top: 30px;

    color: #ffffff;

    font-size: 15px;
    font-weight: 400;

    text-align: center;
}

/* =========================================
   TOOL PANEL CONTENT
========================================= */

.tool-panel-header {
    padding-bottom: 18px;

    border-bottom: 1px solid var(--border);
}

.tool-panel-title {
    display: flex;
    align-items: center;

    gap: 10px;

    margin-bottom: 8px;
}

.tool-panel-title svg {
    width: 22px;
    height: 22px;

    color: var(--primary);
}

.tool-panel-title h2 {
    margin: 0;

    font-size: 20px;
    font-weight: 600;
}

.tool-panel-header p {
    margin: 0;

    color: var(--muted);

    font-size: 13px;
    line-height: 1.5;
}


/* =========================================
   TOOL PANEL BODY
========================================= */

.tool-panel-body {
    flex: 1;

    min-height: 0;

    padding-top: 20px;

    overflow-y: auto;
    overflow-x: hidden;

    padding-right: 6px;

    /* For firefox */
    scrollbar-width: thin;
    scrollbar-color: #d7b5f5 transparent;
}

.tool-panel-body::-webkit-scrollbar {
    width: 6px;
}

.tool-panel-body::-webkit-scrollbar-track {
    background: transparent;
}

.tool-panel-body::-webkit-scrollbar-thumb {
    background: #d7b5f5;
    border-radius: 999px;
}

.tool-panel-body::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.tool-placeholder {
    padding: 20px;

    border: 1px dashed #d8d8d8;
    border-radius: 10px;

    background: #ffffff;

    color: #8b8b8b;

    font-size: 13px;
    text-align: center;
}

/* =========================================
   SHAPE PANEL
========================================= */

.shape-panel {
    width: 100%;
}


/* =========================================
   SHAPE GRID
========================================= */

.shape-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 12px;
}


/* =========================================
   SHAPE CARD
========================================= */

.shape-card {
    width: 100%;

    padding: 12px 8px 10px;

    display: flex;
    flex-direction: column;
    align-items: center;

    gap: 8px;

    border: 1px solid #e2e2e2;
    border-radius: 12px;

    background: #ffffff;

    color: var(--text);

    cursor: pointer;

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


.shape-card:hover {
    border-color: #c99cff;

    background: #fcf9ff;

    transform: translateY(-1px);
}


.shape-card.selected {
    border-color: var(--primary);

    background: var(--primary-light);

    box-shadow:
        0 0 0 2px
        rgba(140, 0, 230, 0.08);
}


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

.shape-preview {
    width: 58px;
    height: 82px;

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


.shape-preview img {
    display: block;

    max-width: 100%;
    max-height: 100%;

    object-fit: contain;
}


.shape-card span {
    font-size: 12px;
    font-weight: 500;
}

/* =========================================
   FILL PANEL
========================================= */

.fill-panel {
    width: 100%;
}


/* =========================================
   FILL SECTIONS
========================================= */

.fill-section + .fill-section {
    margin-top: 24px;
}

.fill-section-heading {
    margin-bottom: 14px;
}

.fill-section-heading h3 {
    margin: 0 0 4px;

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

.fill-section-heading p {
    margin: 0;

    color: var(--muted);

    font-size: 12px;
}


/* =========================================
   COLOR GRID
========================================= */

.color-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 9px;
}


/* =========================================
   COLOR SWATCH
========================================= */

.color-swatch {
    min-width: 0;

    display: flex;
    align-items: center;

    gap: 8px;

    padding: 8px;

    border: 1px solid #e2e2e2;
    border-radius: 9px;

    background: #ffffff;

    cursor: pointer;

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


.color-swatch:hover {
    border-color: #c99cff;

    background: #fcf9ff;
}


.color-swatch.selected {
    border-color: var(--primary);

    background: var(--primary-light);

    box-shadow:
        0 0 0 2px
        rgba(140, 0, 230, 0.08);
}


.color-preview {
    flex: 0 0 auto;

    width: 26px;
    height: 26px;

    border: 1px solid
        rgba(0, 0, 0, 0.12);

    border-radius: 50%;
}


.color-name {
    min-width: 0;

    overflow: hidden;

    color: var(--text);

    font-size: 11px;
    font-weight: 500;

    text-overflow: ellipsis;

    white-space: nowrap;
}


/* =========================================
   CUSTOM COLOR
========================================= */

.custom-color-control {
    display: flex;
    align-items: center;

    gap: 12px;

    padding: 10px;

    border: 1px solid #e2e2e2;
    border-radius: 10px;

    background: #ffffff;
}


.custom-color-input {
    width: 46px;
    height: 38px;

    padding: 2px;

    border: 0;

    background: transparent;

    cursor: pointer;
}


#customColorValue {
    color: var(--text);

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

    letter-spacing: 0.04em;
}


/* =========================================
   FILL FEEDBACK
========================================= */

.fill-message {
    min-height: 32px;

    margin-top: 16px;

    padding: 8px 10px;

    border-radius: 8px;

    background: var(--primary-light);

    color: var(--primary-dark);

    font-size: 11px;

    opacity: 0;

    transition: opacity 0.2s ease;
}


.fill-message.visible {
    opacity: 1;
}


/* =========================================
   IMAGE FILL
========================================= */

.image-fill-input {
    display: none;
}


.image-upload-button {
    width: 100%;

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

    gap: 8px;

    padding: 12px;

    border: 1px dashed
        #c99cff;

    border-radius: 10px;

    background:
        #fcf9ff;

    color:
        var(--primary);

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

    cursor: pointer;

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


.image-upload-button:hover {
    background:
        var(--primary-light);

    border-color:
        var(--primary);
}


.image-upload-button svg {
    width: 18px;
    height: 18px;
}


.image-file-name {
    margin-top: 8px;

    overflow: hidden;

    color: var(--muted);

    font-size: 11px;

    text-overflow: ellipsis;

    white-space: nowrap;
}

/* =========================================
   PATTERN PANEL
========================================= */

.pattern-panel {
    width: 100%;
}


.pattern-section-heading {
    margin-bottom: 14px;
}


.pattern-section-heading h3 {
    margin: 0 0 4px;

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


.pattern-section-heading p {
    margin: 0;

    color: var(--muted);

    font-size: 12px;
    line-height: 1.4;
}


/* =========================================
   PATTERN GRID
========================================= */

.pattern-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 10px;
}


/* =========================================
   PATTERN CARD
========================================= */

.pattern-card {
    display: flex;
    flex-direction: column;
    align-items: center;

    gap: 7px;

    padding: 9px;

    border: 1px solid #e2e2e2;
    border-radius: 10px;

    background: #ffffff;

    color: var(--text);

    cursor: pointer;

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


.pattern-card:hover {
    border-color: #c99cff;

    background: #fcf9ff;

    transform: translateY(-1px);
}


.pattern-card.selected {
    border-color: var(--primary);

    background: var(--primary-light);
}


.pattern-card span {
    font-size: 11px;
    font-weight: 500;
}


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

.pattern-preview {
    width: 100%;
    height: 52px;

    border: 1px solid #dedede;
    border-radius: 7px;

    background-color: #ffffff;
}


/* NONE */

.pattern-preview-none {
    background:
        linear-gradient(
            135deg,
            transparent 45%,
            #dddddd 46%,
            #dddddd 54%,
            transparent 55%
        );
}


/* DOTS */

.pattern-preview-dots {
    background-image:
        radial-gradient(
            #8c00e6 3px,
            transparent 3px
        );

    background-size:
        16px 16px;
}


/* DIAGONAL */

.pattern-preview-diagonal {
    background-image:
        repeating-linear-gradient(
            135deg,
            #8c00e6 0,
            #8c00e6 2px,
            transparent 2px,
            transparent 12px
        );
}


/* VERTICAL */

.pattern-preview-vertical {
    background-image:
        repeating-linear-gradient(
            90deg,
            #8c00e6 0,
            #8c00e6 2px,
            transparent 2px,
            transparent 14px
        );
}


/* HORIZONTAL */

.pattern-preview-horizontal {
    background-image:
        repeating-linear-gradient(
            0deg,
            #8c00e6 0,
            #8c00e6 2px,
            transparent 2px,
            transparent 14px
        );
}


/* GRID */

.pattern-preview-grid {
    background-image:
        linear-gradient(
            #8c00e6 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            #8c00e6 1px,
            transparent 1px
        );

    background-size:
        16px 16px;
}


/* CHECKER */

.pattern-preview-checker {
    background-image:
        linear-gradient(
            45deg,
            #8c00e6 25%,
            transparent 25%
        ),
        linear-gradient(
            -45deg,
            #8c00e6 25%,
            transparent 25%
        );

    background-size:
        16px 16px;
}


/* CROSSHATCH */

.pattern-preview-crosshatch {
    background-image:
        repeating-linear-gradient(
            45deg,
            #8c00e6 0,
            #8c00e6 1px,
            transparent 1px,
            transparent 10px
        ),
        repeating-linear-gradient(
            -45deg,
            #8c00e6 0,
            #8c00e6 1px,
            transparent 1px,
            transparent 10px
        );
}


/* =========================================
   PATTERN COLOR
========================================= */

.pattern-color-section {
    margin-top: 22px;
}

/* =========================================
   TEXT PANEL
========================================= */

.text-panel {
    width: 100%;
}


.text-section + .text-section {
    margin-top: 22px;
}


.text-section-heading {
    margin-bottom: 10px;
}


.text-section-heading h3 {
    margin: 0 0 4px;

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


.text-section-heading p {
    margin: 0;

    color: var(--muted);

    font-size: 12px;
    line-height: 1.4;
}


/* =========================================
   TEXT INPUT
========================================= */

.text-content-input {
    width: 100%;

    min-height: 78px;

    padding: 10px 12px;

    resize: vertical;

    border: 1px solid #dddddd;
    border-radius: 10px;

    background: #ffffff;

    color: var(--text);

    font-family: inherit;
    font-size: 13px;

    outline: none;

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


.text-content-input:focus {
    border-color:
        var(--primary);

    box-shadow:
        0 0 0 3px
        rgba(140, 0, 230, 0.08);
}


/* =========================================
   ADD TEXT
========================================= */

.text-add-button {
    width: 100%;

    margin-top: 9px;

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

    gap: 7px;

    padding: 10px;

    border: 0;
    border-radius: 9px;

    background:
        var(--primary);

    color: #ffffff;

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

    cursor: pointer;
}


.text-add-button:hover {
    background:
        var(--primary-dark);
}


.text-add-button svg {
    width: 17px;
    height: 17px;
}


/* =========================================
   FONT SELECT
========================================= */

.text-select {
    width: 100%;

    padding: 10px 12px;

    border: 1px solid #dddddd;
    border-radius: 9px;

    background: #ffffff;

    color: var(--text);

    font-family: inherit;
    font-size: 12px;

    cursor: pointer;

    outline: none;
}


.text-select:focus {
    border-color:
        var(--primary);
}


/* =========================================
   TEXT COLOR
========================================= */

.text-color-control {
    display: flex;
    align-items: center;

    gap: 12px;

    padding: 10px;

    border: 1px solid #e2e2e2;
    border-radius: 10px;

    background: #ffffff;
}


#textColorValue {
    font-size: 12px;
    font-weight: 500;

    letter-spacing: 0.04em;
}


/* =========================================
   TEXT FORMAT
========================================= */

.text-format-controls {
    display: grid;

    grid-template-columns:
        1fr 48px 48px;

    gap: 7px;
}


.text-format-button {
    min-height: 40px;

    border: 1px solid #dddddd;
    border-radius: 8px;

    background: #ffffff;

    color: var(--text);

    font-size: 12px;

    cursor: pointer;

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


.text-format-button:hover {
    border-color:
        #c99cff;
}


.text-format-button.selected {
    border-color:
        var(--primary);

    background:
        var(--primary-light);

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


/* =========================================
   TEXT HELP
========================================= */

.text-help {
    margin-top: 22px;

    padding: 11px;

    border-radius: 9px;

    background: #f7f7f7;

    color: var(--muted);

    font-size: 11px;
    line-height: 1.5;
}