/* Design Tokens */
:root {
    --bg-color: #0a0a0a;
    --card-bg: #161616;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-color: #ffffff;
    --accent-hover: #eeeeee;
    --border-color: #2a2a2a;
    --input-bg: #222222;
    --font-main: 'Inter', -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.6;
}

header {
    padding: 0 1rem;
    margin-top: -1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.site-logo {
    width: 200px;
    height: 200px;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.1));
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

header h1.hero-title {
    font-size: 1.4rem;
    font-weight: 400;
    line-height: 1.3;
    color: var(--text-primary);
    margin: -2.5rem 0 1.5rem 0;
    letter-spacing: -0.2px;
    opacity: 0.8;
}

header h1.hero-title span {
    display: block;
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-top: 0.3rem;
    letter-spacing: 0;
}

main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
}

h2,
h3 {
    margin-bottom: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* Upload Section */
.upload-controls {
    text-align: center;
    padding: 2rem;
    transition: border-color 0.3s, background 0.3s;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.upload-label {
    cursor: pointer;
    display: inline-block;
}

.plus-button {
    width: 80px;
    height: 80px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.plus-sign {
    font-size: 42px;
    font-weight: 300;
    color: var(--text-primary);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -4px;
    /* Optical center adjustment */
}

.upload-label:hover .plus-button {
    transform: scale(1.1) rotate(90deg);
    background: var(--text-primary);
    border-color: var(--text-primary);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.upload-label:hover .plus-sign {
    color: var(--bg-color);
}

.hint {
    color: var(--text-secondary);
    margin-top: 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0.8;
}

.crop-instructions {
    margin: -0.5rem 0 1.5rem 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cropper-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 50%;
}

.crop-actions {
    position: absolute;
    bottom: -3.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    width: 100%;
    justify-content: center;
}

.btn-sm {
    padding: 0.6rem 1.2rem !important;
    font-size: 0.85rem !important;
    white-space: nowrap;
}

/* Cropper Circular Mask Hack */
.cropper-view-box,
.cropper-face {
    border-radius: 50%;
}

.editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.controls-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.control-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

input[type="range"] {
    width: 100%;
    accent-color: #fff;
}

input[type="color"] {
    display: none;
}

.custom-color-picker {
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.color-swatch {
    width: 48px;
    height: 48px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--input-bg);
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    position: relative;
}

.color-swatch:hover {
    transform: scale(1.05);
    border-color: var(--text-secondary);
}

.color-swatch::after {
    content: '';
    position: absolute;
    inset: 4px;
    background: inherit;
    border-radius: 8px;
}

.color-picker-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 100;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem;
    width: 240px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    display: none;
    user-select: none;
}

.color-picker-dropdown.active {
    display: block;
    animation: fadeInScale 0.2s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.picker-saturation {
    width: 100%;
    height: 150px;
    border-radius: 8px;
    position: relative;
    cursor: crosshair;
    margin-bottom: 1rem;
    background-image: linear-gradient(to top, #000, transparent),
        linear-gradient(to right, #fff, transparent);
}

.picker-saturation-cursor {
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-radius: 50%;
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.picker-hue {
    width: 100%;
    height: 12px;
    border-radius: 6px;
    position: relative;
    cursor: pointer;
    margin-bottom: 1rem;
    background: linear-gradient(to right,
            #ff0000 0%, #ffff00 17%, #00ff00 33%,
            #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
}

.picker-hue-cursor {
    width: 16px;
    height: 16px;
    background: #fff;
    border: 2px solid var(--bg-color);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.picker-footer {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.picker-hex-input {
    flex: 1;
    padding: 0.5rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.picker-preview {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

input[type="text"],
select {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
select:focus {
    border-color: var(--text-secondary);
}

/* Tabs Selection Bar */
.style-selection-card {
    padding: 1.5rem 2rem !important;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.section-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
}

.style-tabs {
    display: flex;
    background: var(--input-bg);
    padding: 5px;
    border-radius: 14px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.6rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9rem;
}

.tab-btn.active {
    background: var(--bg-color);
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Customization Card Scrollbar (Mobile only) */
.customization-card {
    -webkit-overflow-scrolling: touch;
}

/* Webkit scrollbar customization - Shared but inactive unless overflow is set */
.customization-card::-webkit-scrollbar {
    width: 6px;
}

.customization-card::-webkit-scrollbar-track {
    background: transparent;
    margin: 10px 0;
}

.customization-card::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.control-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.gradient-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.grad-color-row {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: visible;
}

.grad-color-input {
    width: 100%;
    height: 100%;
    border: none;
    /* Inherits from global input[type="color"] or overridden */
}

.remove-color {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff5555;
    color: white;
    border: 2px solid var(--card-bg);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: transform 0.2s;
}

.remove-color:hover:not(:disabled) {
    transform: scale(1.2);
}

.remove-color:disabled {
    display: none;
}

.btn-secondary {
    background: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #333;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    font-weight: 500;
}

/* Preview Column */
.preview-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    position: sticky;
    top: 2rem;
    align-self: start;
}

.preview-container {
    position: relative;
    width: 400px;
    height: 400px;
    background: #000;
    border-radius: 50%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border: 2px dashed var(--border-color);
    overflow: visible;
    /* To allow crop-actions to be outside */
    transition: border-color 0.3s;
}

.preview-container.has-image {
    border: none;
}

.change-image-btn {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 10;
}

.change-image-btn:hover {
    opacity: 1;
}

.change-image-btn span {
    background: #fff;
    color: #000;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
}

#previewCanvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.preview-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Buttons */
.btn-primary {
    background: #fff;
    color: #000;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    transition: transform 0.2s, opacity 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* Social Overlay */
.overlay-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.overlay-container.active {
    opacity: 1;
}

.tiktok-ui {
    width: 100%;
    height: 100%;
    position: relative;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 50%;
}

.tiktok-ui::after {
    content: '+';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translate(-50%, 50%);
    background: #ff0050;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid #000;
}

footer {
    text-align: center;
    padding: 3rem 1rem 1rem 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

@media (max-width: 53.125rem) {

    /* 850px */
    .editor-grid {
        grid-template-columns: 1fr;
    }

    .preview-col {
        order: -1;
    }

    .preview-container {
        width: min(85vw, 20rem);
        height: min(85vw, 20rem);
    }
}

/* SEO Content Section Styling */
.seo-content-section {
    margin-top: 4rem;
    padding-top: 4rem;
    border-top: 1px solid var(--border-color);
}

.seo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.seo-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.seo-card:hover {
    background: rgba(255, 255, 255, 0.04);
}

.seo-card h2,
.seo-card h3 {
    color: var(--text-primary);
    background: linear-gradient(to right, #fff, #a0a0a0);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.seo-card h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.seo-card h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.seo-card p,
.seo-card li {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.seo-card ul {
    list-style: none;
}

.seo-card ul li {
    position: relative;
    padding-left: 1.5rem;
}

.seo-card ul li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: #fff;
    font-weight: bold;
}

/* Full-width SEO sections */
.full-width-card {
    grid-column: 1 / -1;
}


.faq-item {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.faq-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.faq-item h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.faq-item p {
    margin-bottom: 0;
    opacity: 0.8;
}

@media (max-width: 53.125rem) {
    .seo-grid {
        grid-template-columns: 1fr;
    }

    .preview-col {
        position: static;
        order: -1;
    }
}

/* Mobile Specific Changes for 500px and below */
@media (max-width: 31.25rem) {
    .preview-col {
        margin-bottom: 1rem;
    }

    .customization-card {
        max-height: 65dvh;
        overflow-y: auto;
        /* Force clipping of scrollbar track to rounded corners */
        clip-path: inset(0 round 20px);
    }

    /* Webkit scrollbar customization */
    .customization-card::-webkit-scrollbar {
        width: 6px;
    }

    .customization-card::-webkit-scrollbar-track {
        background: transparent;
        margin: 10px 0;
        /* Prevents track from reaching the very top/bottom of the rounded box */
    }

    .customization-card::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 10px;
    }
}