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

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Inter", Arial, sans-serif;
    background: #f6f6f8;
    color: #222;
    transition: background .3s, color .3s;
}

body.dark {
    background: #101014;
    color: #e5e5e5;
}

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

.app-header {
    background: #ffffffcc;
    backdrop-filter: blur(10px);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e5e5;
    position: sticky;
    top: 0;
    z-index: 100;
}

body.dark .app-header {
    background: #18181dcc;
    border-bottom-color: #333;
}

.logo {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.dot-circle {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #8b4eff;
    border-radius: 50%;
    margin: 0 3px;
    transform: translateY(2px); /* baseline fix */
}

body.dark .dot-circle {
    background: #b388ff;
}

.header-actions {
    display: flex;
    gap: 14px;
    align-items: center;
}

.theme-toggle {
    background: #ddd;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
}

body.dark .theme-toggle {
    background: #333;
}

.tag-pro {
    background: #8b4eff;
    color: white;
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.2px;
}

/* ================== LAYOUT ================== */

.layout {
    display: flex;
    gap: 24px;
    padding: 24px;
}

.sidebar {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

/* ================== CARDS ================== */

.card {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.05);
}

body.dark .card {
    background: #1a1a1f;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

.card h2 {
    margin-top: 0;
    font-size: 18px;
}

/* ================== INPUTS & SELECTS ================== */

input, select, textarea {
    width: 100%;
    padding: 10px;
    margin-top: 4px;
    margin-bottom: 12px;
    border-radius: 8px;
    border: 1px solid #ccc;
    background: #fff;
    font-size: 14px;
}

body.dark input,
body.dark select,
body.dark textarea {
    background: #2a2a2f;
    color: #eee;
    border-color: #444;
}

/* Label with icon */
.icon-label {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.icon-label .icon {
    opacity: 0.7;
    font-size: 14px;
}

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

.btn {
    padding: 12px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 4px;
    font-size: 15px;
    transition: .2s;
    width: 100%;
}

/* Pro-purple button */
.primary-btn {
    background: #8b4eff;
    color: #fff;
}

.primary-btn:hover {
    background: #7340dd;
}

/* Neutral gray button */
.btn:not(.primary-btn) {
    background: #dadee7;
    color: #222;
}

.btn:not(.primary-btn):hover {
    background: #cfd3da;
}

/* ================== COLLAPSIBLE SIDEBAR ================== */

.sidebar-group {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.collapse-section {}

.collapse-header {
    width: 100%;
    background: #ececf3;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: background .2s;
}

.collapse-header.open {
    background: #dcd9ff;
}

body.dark .collapse-header {
    background: #2c2a33;
}

body.dark .collapse-header.open {
    background: #3a3566;
}

.collapse-content {
    display: none;
    padding-top: 12px;
}

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

.preview-box {
    background: #e3e3e6;
    border-radius: 12px;
    min-height: 480px;
    padding: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
}

body.dark .preview-box {
    background: #2a2a33;
}

/* Canvas auto sizing */
#previewCanvas {
    max-width: 100%;
    height: auto;
}

/* ================== RESPONSIVE ================== */

@media (max-width: 900px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }
}
