/* ===================================
   PLATFORM CSS - Shop Builder
   =================================== */

:root {
    --color-primary: #000000;
    --color-accent: #6366f1;
    --color-bg: #ffffff;
    --color-bg-secondary: #f8f9fa;
    --color-text: #111111;
    --color-text-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-success: #10b981;
    --color-error: #ef4444;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --header-height: 64px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.15);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    color: var(--color-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    background: var(--color-bg);
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

img {
    max-width: 100%;
    display: block;
}

/* ===== HEADER ===== */
.header {
    height: var(--header-height);
    border-bottom: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.header__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 700;
}

.header__logo svg {
    flex-shrink: 0;
}

.header__nav {
    display: flex;
    gap: 24px;
}

.header__nav a {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    transition: color 0.2s;
}

.header__nav a:hover {
    color: var(--color-text);
}

.header__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header__user {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    cursor: pointer;
}

.btn--primary {
    background: var(--color-primary);
    color: #fff;
}

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

.btn--secondary {
    background: var(--color-bg-secondary);
    color: var(--color-text);
}

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

.btn--ghost {
    background: transparent;
    color: var(--color-text);
}

.btn--ghost:hover {
    background: #f3f4f6;
}

.btn--large {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn--full {
    width: 100%;
}

.btn--link {
    background: none;
    border: none;
    color: var(--color-accent);
    padding: 0;
}

.btn__loader {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn.loading .btn__text {
    display: none;
}

.btn.loading .btn__loader {
    display: block;
}

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

/* ===== HERO ===== */
.hero {
    min-height: calc(100vh - var(--header-height) - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.hero__container {
    max-width: 800px;
    text-align: center;
}

.hero__title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #111 0%, #444 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero__subtitle {
    font-size: 1.2rem;
    color: var(--color-text-muted);
    margin-bottom: 40px;
}

/* ===== PROMPT FORM ===== */
.prompt-form {
    max-width: 600px;
    margin: 0 auto;
}

.prompt-form__input-wrapper {
    position: relative;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 20px;
}

.prompt-form__input {
    width: 100%;
    border: none;
    resize: none;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.5;
    outline: none;
}

.prompt-form__input::placeholder {
    color: #9ca3af;
}

.prompt-form__submit {
    position: absolute;
    bottom: 16px;
    right: 16px;
}

.hero__examples {
    margin-top: 24px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.hero__examples span {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.hero__examples button {
    background: #fff;
    border: 1px solid var(--color-border);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.hero__examples button:hover {
    border-color: var(--color-text);
}

/* ===== FEATURES ===== */
.features {
    padding: 80px 24px;
    background: #fff;
}

.features__container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    max-width: 1000px;
    margin: 0 auto;
}

.feature {
    text-align: center;
}

.feature__icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.feature h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.feature p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ===== DASHBOARD ===== */
.dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px;
}

.dashboard__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.dashboard__header h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.dashboard__empty {
    text-align: center;
    padding: 80px 24px;
}

.dashboard__empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.dashboard__empty h2 {
    margin-bottom: 8px;
}

.dashboard__empty p {
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

.dashboard__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

/* ===== SHOP CARD ===== */
.shop-card {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.shop-card:hover {
    box-shadow: var(--shadow-md);
}

.shop-card__preview {
    aspect-ratio: 16/10;
    background: var(--color-bg-secondary);
    overflow: hidden;
    position: relative;
}

.shop-card__preview iframe {
    width: 200%;
    height: 200%;
    transform: scale(0.5);
    transform-origin: top left;
    pointer-events: none;
    border: none;
}

.shop-card__info {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}

.shop-card__info h3 {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.shop-card__url {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.shop-card__actions {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
}

.shop-card__actions .btn {
    flex: 1;
}

/* ===== BUILDER ===== */
.builder {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    height: calc(100vh - var(--header-height));
}

.builder__sidebar {
    background: var(--color-bg-secondary);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
}

.builder__sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}

.builder__back {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.builder__back:hover {
    color: var(--color-text);
}

.builder__nav {
    padding: 16px 12px;
}

.builder__nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    text-align: left;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.builder__nav-item:hover {
    background: #fff;
    color: var(--color-text);
}

.builder__nav-item--active {
    background: #fff;
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
}

.builder__panel {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.builder__panel h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.builder__panel h4 {
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 16px;
    margin-bottom: 8px;
}

.builder__panel hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 20px 0;
}

/* ===== BUILDER PREVIEW ===== */
.builder__preview {
    display: flex;
    flex-direction: column;
    background: var(--color-bg-secondary);
}

.builder__preview-header {
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
}

.builder__url {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--color-bg-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.builder__url-icon {
    font-size: 0.8rem;
}

.builder__url-open {
    color: var(--color-text-muted);
    margin-left: 4px;
}

.builder__iframe {
    flex: 1;
    border: none;
    background: #fff;
    border-radius: 8px;
    margin: 16px;
}

/* ===== BUILDER CHAT ===== */
.builder__chat {
    background: #fff;
    border-left: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
}

.builder__chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}

.builder__chat-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.builder__chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.chat-message {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.5;
}

.chat-message--ai {
    background: var(--color-bg-secondary);
}

.chat-message--user {
    background: var(--color-primary);
    color: #fff;
}

.builder__chat-form {
    padding: 16px 20px;
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 8px;
}

.builder__chat-form input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.builder__chat-form input:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-group input[type="color"] {
    height: 44px;
    padding: 4px;
}

.form-error {
    color: var(--color-error);
    font-size: 0.85rem;
    margin-top: 8px;
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: all 0.2s;
}

.modal--active {
    visibility: visible;
    opacity: 1;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal__content {
    position: relative;
    background: #fff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

/* ===== AUTH MODAL ===== */
.auth-modal {
    padding: 32px;
}

.auth-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-muted);
    cursor: pointer;
}

.auth-modal__tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.auth-modal__tab {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.auth-modal__tab--active {
    color: var(--color-text);
    border-bottom-color: var(--color-primary);
}

.auth-modal__form h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.auth-modal__form p {
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

/* ===== VERIFY MODAL ===== */
.verify-modal {
    padding: 32px;
    text-align: center;
}

.verify-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-muted);
    cursor: pointer;
}

.verify-modal__icon {
    margin-bottom: 20px;
}

.verify-modal h2 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.verify-modal p {
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

.verify-modal__form input {
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 8px;
}

.verify-modal__resend {
    margin-top: 24px;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* ===== FOOTER ===== */
.footer {
    background: var(--color-bg-secondary);
    padding: 60px 24px 40px;
    margin-top: auto;
}

.footer__container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 40px;
}

.footer__brand span {
    font-weight: 700;
    font-size: 1.1rem;
}

.footer__brand p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-top: 8px;
}

.footer__links {
    display: flex;
    gap: 24px;
}

.footer__links a {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.footer__links a:hover {
    color: var(--color-text);
}

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

/* ===== ERROR PAGE ===== */
.error-page {
    text-align: center;
    padding: 80px 24px;
}

.error-page h1 {
    font-size: 6rem;
    font-weight: 800;
    color: #e5e7eb;
    margin-bottom: 8px;
}

.error-page p {
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .builder {
        grid-template-columns: 1fr;
    }

    .builder__sidebar,
    .builder__chat {
        display: none;
    }
}

@media (max-width: 640px) {
    .footer__container {
        flex-direction: column;
        text-align: center;
    }

    .footer__links {
        justify-content: center;
    }
}