:root {
    font-family: "Space Grotesk", "Inter", system-ui, -apple-system, sans-serif;
    background-color: #1e1e2e;
    color: #cdd6f4;
    line-height: 1.6;
    --primary: #cba6f7;
    --primary-hover: #b4befe;
    --surface: #313244;
    --bg: #1e1e2e;
    --border: #45475a;
    --text: #cdd6f4;
    --text-muted: #a6adc8;
    --radius: 1rem;
    --shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.3), 0 12px 40px -4px rgba(0, 0, 0, 0.2);
    --shadow-hover: 0 8px 30px -2px rgba(203, 166, 247, 0.15), 0 20px 50px -4px rgba(203, 166, 247, 0.1);
}

* {
    box-sizing: border-box;
}

p {
    white-space: pre-wrap;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

body {
    min-height: 100vh;
    padding: 1rem 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.left-panel {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.app-header {
    animation: slideIn 0.6s ease-out 0.1s both;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.app-header h1 {
    margin: 0.75rem 0;
    font-size: clamp(2.2rem, 5vw, 3rem);
    font-weight: 700;
    background: linear-gradient(135deg, #cba6f7 0%, #89b4fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 1rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, #45475a 0%, #313244 100%);
    color: #cba6f7;
    box-shadow: 0 2px 8px rgba(203, 166, 247, 0.15);
}

.lead {
    margin: 0;
    font-size: 1.15rem;
    color: var(--text-muted);
    line-height: 1.7;
}

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

.input-panel {
    padding-right: 2rem;
    animation: slideIn 0.6s ease-out 0.2s both;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.form-grid .input-actions {
    grid-column: 1 / -1;
}

.preview-panel {
    padding-left: 2rem;
    border-left: 2px solid var(--border);
    animation: slideIn 0.6s ease-out 0.3s both;
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 1.25rem;
}

input,
textarea,
select {
    font: inherit;
    border-radius: 0.85rem;
    border: 2px solid var(--border);
    padding: 0.75rem 1rem;
    background: #1e1e2e;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    font-size: 1rem;
    color: #cdd6f4;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    background: #181825;
    box-shadow: 0 0 0 4px rgba(203, 166, 247, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: #6c7086;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a6adc8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

select option {
    background: #1e1e2e;
    color: #cdd6f4;
}

.input-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 2rem;
}

#platform-checkboxes {
    display: flex;
    justify-content: space-evenly;
}

.inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.inline input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--primary);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.inline:hover input[type="checkbox"] {
    transform: scale(1.1);
}

.submit-row {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

button {
    font: inherit;
    border-radius: 1rem;
    border: none;
    padding: 1rem 1.75rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

#generate-btn {
    background: linear-gradient(135deg, var(--primary) 0%, #89b4fa 100%);
    color: #1e1e2e;
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
}

#generate-btn:hover:not(:disabled) {
    transform: translateY(-6px);
}

#generate-btn:active:not(:disabled) {
    transform: translateY(0);
}

#generate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-loader {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(30, 30, 46, 0.3);
    border-top-color: #1e1e2e;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#generate-btn.loading .btn-text {
    opacity: 0;
}

#generate-btn.loading .btn-loader {
    display: inline-block;
    position: absolute;
}

.hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.platform-tabs {
    position: relative;
    display: flex;
    justify-content: space-around;
    margin-bottom: 1rem;
    padding-bottom: 2px;
}

.platform-tabs::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border);
}

.platform-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 0;
    transition: color 0.2s ease, border-color 0.2s ease;
    position: relative;
    z-index: 1;
}

.platform-tab:hover {
    color: var(--primary);
}

.platform-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.platform {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--primary);
    text-transform: uppercase;
}

.preview-text {
    margin: 0;
    color: var(--text);
    font-size: 1rem;
    line-height: 1.65;
    min-height: 1.65em;
    animation: typewriter 0.5s ease-out;
    flex: 1;
}

#preview-container {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.copy-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.25rem 0.75rem;
    margin-bottom: 1.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s ease;
}

.copy-btn[data-copyable] {
    background: linear-gradient(135deg, #45475a 0%, #313244 100%);
    color: var(--primary);
    border: 2px solid var(--primary);
    cursor: pointer;
}

.copy-btn[data-copyable]:hover {
    background: var(--primary);
    color: #1e1e2e;
}

@keyframes typewriter {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.facebook,
.threads,
.instagram,
.line,
.dcard,
.email {
    display: none;
}

:has(#facebook:checked) .facebook {
    display: flex;
}

:has(#threads:checked) .threads {
    display: flex;
}

:has(#instagram:checked) .instagram {
    display: flex;
}

:has(#dcard:checked) .dcard {
    display: flex;
}

:has(#line:checked) .line {
    display: flex;
}

:has(#email:checked) .email {
    display: flex;
}
