/* Site Builder — v21 Final Design */

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

:root {
    --violet: #8b5cf6;
    --purple: #7c3aed;
    --pink: #ec4899;
    --indigo: #6366f1;
    --blue: #3b82f6;
    --grad-main: linear-gradient(135deg, #8b5cf6, #ec4899);
    --grad-full: linear-gradient(135deg, #8b5cf6, #ec4899, #3b82f6);
    --grad-subtle: linear-gradient(135deg, rgba(139,92,246,0.08), rgba(236,72,153,0.06));
    --text: #1e1b4b;
    --text-dim: #6b7280;
    --bg: #fafbff;
    --card-bg: #ffffff;
    --border: rgba(139,92,246,0.12);
    --radius: 16px;
    --radius-sm: 12px;
    --shadow: 0 4px 24px rgba(139,92,246,0.08);
    --shadow-lg: 0 8px 40px rgba(139,92,246,0.12);
    --success: #16a34a;
    --error: #dc2626;
}

@keyframes waveFloat {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-20px); }
}

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 clamp(16px, 4vw, 32px);
}

/* ===== GLASS UTILITIES ===== */
.glass {
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
}

.glass-strong {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius);
}

.gradient-text {
    background: var(--grad-full);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Wave SVG dividers */
.wave-divider {
    width: 100%;
    display: block;
    margin: -1px 0;
    line-height: 0;
}
.wave-divider svg {
    width: 100%;
    height: auto;
    display: block;
}

/* ===== HEADER (glass navbar full-width) ===== */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
}
.nav-logo {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    text-decoration: none;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
}
.nav-links a {
    text-decoration: none;
    color: #4b5563;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 10px;
    transition: all 0.2s ease;
}
.nav-links a:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--violet);
}
.nav-links a.active {
    background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(236,72,153,0.1));
    color: var(--violet);
    font-weight: 600;
}

/* Language switcher (glass pills) */
.lang-switch {
    display: flex;
    gap: 2px;
    background: rgba(255,255,255,0.4);
    border-radius: 10px;
    padding: 3px;
    border: 1px solid rgba(255,255,255,0.5);
}
.lang-switch a {
    background: none;
    border: none;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.lang-switch a.active {
    background: var(--grad-main);
    color: white;
    box-shadow: 0 2px 8px rgba(139,92,246,0.3);
}
.lang-switch a:hover:not(.active) { color: var(--violet); }

/* ===== MAIN CONTENT ===== */
.main {
    min-height: calc(100vh - 140px);
}

/* ===== HERO (wave style) ===== */
.hero-section {
    background: linear-gradient(180deg, var(--bg) 0%, #ede9fe 100%);
    padding: clamp(60px, 10vw, 110px) 0 0;
    text-align: center;
    position: relative;
}
.hero-section h1 {
    font-size: clamp(2.2rem, 5.5vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.1;
    margin-bottom: 18px;
}
.hero-section p {
    color: var(--text-dim);
    font-size: clamp(1rem, 2vw, 1.2rem);
    max-width: 540px;
    margin: 0 auto 32px;
}
.hero-buttons {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

/* ===== BUTTONS ===== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 36px;
    border: none;
    border-radius: 60px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--grad-main);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.3s;
    box-shadow: 0 6px 24px rgba(139,92,246,0.3);
    text-decoration: none;
}
.btn-primary:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 10px 32px rgba(139,92,246,0.4);
}
.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    border: 2px solid transparent;
    background-image: linear-gradient(rgba(255,255,255,0.8), rgba(255,255,255,0.8)), var(--grad-main);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    border-radius: 60px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--violet);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}
.btn-outline:hover {
    background-image: linear-gradient(rgba(255,255,255,0.3), rgba(255,255,255,0.3)), var(--grad-main);
    color: white;
}
.btn-new-site {
    background: var(--grad-main);
    color: white;
    border: none;
    padding: 10px 22px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(139,92,246,0.25);
    text-decoration: none;
}
.btn-new-site:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(139,92,246,0.35);
}
.gradient-btn {
    background: var(--grad-main);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
    width: 100%;
}
.gradient-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
}

/* ===== SECTION COMMON ===== */
.content-section {
    padding: clamp(40px, 6vw, 70px) 0;
}
.section-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-title .icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(236,72,153,0.1));
    font-size: 18px;
}

/* ===== LOGIN / REGISTER (glass panel) ===== */
.login-section {
    position: relative;
}
.login-wrapper {
    display: flex;
    justify-content: center;
}
.login-card {
    width: 420px;
    max-width: 100%;
    padding: 36px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.06);
}
.login-card h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
}
.login-card .subtitle {
    color: #9ca3af;
    font-size: 14px;
    margin-bottom: 28px;
}
.form-group {
    margin-bottom: 18px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 6px;
}
.form-group input {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(139,92,246,0.2);
    background: rgba(255,255,255,0.6);
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: all 0.2s;
}
.form-group input:focus {
    border-color: var(--violet);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.1);
}
.form-group input::placeholder { color: #c4b5d8; }
.form-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}
.telegram-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255,255,255,0.5);
    border: 1px solid rgba(0,136,204,0.2);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: #0088cc;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.telegram-btn:hover {
    background: rgba(0,136,204,0.08);
    border-color: rgba(0,136,204,0.4);
}
.telegram-btn svg { width: 20px; height: 20px; }
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
    color: #c4b5d8;
    font-size: 12px;
    font-weight: 500;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139,92,246,0.2), transparent);
}
.form-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: #9ca3af;
}
.form-footer a {
    color: var(--violet);
    text-decoration: none;
    font-weight: 600;
}
.form-footer a:hover { text-decoration: underline; }

/* ===== ALERTS ===== */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 14px;
    backdrop-filter: blur(10px);
}
.alert-success {
    background: linear-gradient(135deg, rgba(16,185,129,0.12), rgba(52,211,153,0.12));
    color: #059669;
    border: 1px solid rgba(16,185,129,0.2);
}
.alert-error {
    background: linear-gradient(135deg, rgba(239,68,68,0.12), rgba(248,113,113,0.12));
    color: #dc2626;
    border: 1px solid rgba(239,68,68,0.2);
}

/* ===== DASHBOARD / SITES LIST (glass style) ===== */
.dashboard-section {
    position: relative;
}
.sites-panel {
    padding: 28px;
    box-shadow: var(--shadow-lg);
}
.sites-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.sites-count { font-size: 14px; color: #9ca3af; }
.sites-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 6px;
}
.sites-table thead th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #9ca3af;
    padding: 0 16px 10px;
}
.sites-table tbody tr {
    background: rgba(255,255,255,0.45);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    transition: all 0.2s ease;
}
.sites-table tbody tr:hover {
    background: rgba(255,255,255,0.7);
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(139,92,246,0.08);
}
.sites-table td {
    padding: 14px 16px;
    font-size: 14px;
}
.sites-table td:first-child { border-radius: 12px 0 0 12px; }
.sites-table td:last-child { border-radius: 0 12px 12px 0; }
.site-name-text { font-weight: 600; color: #2d2b3d; }
.site-url { font-size: 12px; color: #9ca3af; }
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.status-live {
    background: linear-gradient(135deg, rgba(16,185,129,0.12), rgba(52,211,153,0.12));
    color: #059669;
}
.status-live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #10b981; }
.status-draft {
    background: linear-gradient(135deg, rgba(251,191,36,0.12), rgba(252,211,77,0.12));
    color: #d97706;
}
.status-draft::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #f59e0b; }
.status-paused {
    background: linear-gradient(135deg, rgba(156,163,175,0.12), rgba(209,213,219,0.12));
    color: #6b7280;
}
.status-paused::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #9ca3af; }
.edit-btn {
    background: linear-gradient(135deg, rgba(139,92,246,0.08), rgba(236,72,153,0.05));
    border: 1px solid rgba(139,92,246,0.2);
    color: #8b5cf6;
    padding: 7px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}
.edit-btn:hover {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    color: white;
    border-color: transparent;
}

/* Dashboard empty state */
.dashboard-empty {
    text-align: center;
    padding: 3rem 0;
}
.dashboard-empty p {
    color: var(--text-dim);
    margin-bottom: 1.5rem;
    font-size: 15px;
}

/* ===== CHAT (glass panel with avatars) ===== */
.chat-section {
    position: relative;
}
.chat-panel {
    max-width: 640px;
    margin: 0 auto;
    padding: 0;
    box-shadow: 0 8px 40px rgba(0,0,0,0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 480px;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
}
.chat-header {
    padding: 18px 24px;
    border-bottom: 1px solid rgba(139,92,246,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255,255,255,0.4);
}
.chat-header .avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--grad-main);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 700;
}
.chat-header .info h3 { font-size: 15px; font-weight: 700; color: var(--text); }
.chat-header .info span { font-size: 12px; color: #10b981; }
.chat-header-title { font-size: 15px; font-weight: 700; color: var(--text); flex: 1; }
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(250,251,255,0.5);
}
.message {
    display: flex;
    gap: 10px;
    max-width: 80%;
}
.message.bot { align-self: flex-start; }
.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message .bubble {
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
}
.message.bot .bubble {
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.5);
    border-bottom-left-radius: 6px;
    color: var(--text);
}
.message.user .bubble {
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 12px rgba(139,92,246,0.2);
}
.message .msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}
.message.bot .msg-avatar {
    background: var(--grad-main);
    color: white;
    font-weight: 700;
}
.message.user .msg-avatar {
    background: rgba(139,92,246,0.1);
    color: var(--violet);
}
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 14px 18px;
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    align-self: flex-start;
    border: 1px solid rgba(255,255,255,0.5);
    margin-left: 42px;
}
.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--violet);
}
.typing-indicator span:nth-child(1) { animation: typing 1.2s infinite 0s; }
.typing-indicator span:nth-child(2) { animation: typing 1.2s infinite 0.2s; }
.typing-indicator span:nth-child(3) { animation: typing 1.2s infinite 0.4s; }
.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid rgba(139,92,246,0.08);
    display: flex;
    gap: 10px;
    align-items: center;
    background: rgba(255,255,255,0.4);
}
.chat-input-area input {
    flex: 1;
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px solid rgba(139,92,246,0.15);
    background: rgba(255,255,255,0.6);
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    color: var(--text);
}
.chat-input-area input:focus {
    border-color: var(--violet);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.08);
}
.chat-input-area input::placeholder { color: #c4b5d8; }
.chat-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.send-btn {
    background: var(--grad-main);
    color: white;
    box-shadow: 0 4px 12px rgba(139,92,246,0.3);
}
.send-btn:hover { transform: scale(1.05); box-shadow: 0 6px 20px rgba(139,92,246,0.4); }
.mic-btn {
    background: rgba(255,255,255,0.6);
    color: var(--violet);
    border: 1px solid rgba(139,92,246,0.15);
}
.mic-btn:hover { background: rgba(139,92,246,0.08); }
.mic-btn.recording {
    background: var(--error);
    color: #fff;
    border-color: var(--error);
    animation: pulse 1s infinite;
}

/* Chat welcome */
.chat-welcome {
    text-align: center;
    color: var(--text-dim);
    padding: 3rem 1rem;
}

/* ===== CREATE PAGE (glass cards) ===== */
.create-section {
    text-align: center;
}
.create-section h1 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
}
.create-section .subtitle {
    color: var(--text-dim);
    font-size: 15px;
    margin-bottom: 32px;
}
.create-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    max-width: 700px;
    margin: 0 auto;
}
.create-option {
    padding: 32px 24px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}
.create-option:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.create-option-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
}
.create-option h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}
.create-option p {
    font-size: 14px;
    color: var(--text-dim);
    margin-bottom: 20px;
}

/* ===== FOOTER ===== */
.site-footer {
    text-align: center;
    padding: 40px 0 30px;
    color: var(--text-dim);
    font-size: 0.85rem;
    background: linear-gradient(180deg, var(--bg) 0%, #ede9fe 100%);
    border-top: 1px solid rgba(139,92,246,0.08);
    margin-top: 2rem;
}

/* ===== ERROR PAGE ===== */
.error-page { text-align: center; padding: 4rem 0; }
.error-page h1 { font-size: 5rem; color: var(--text-dim); }
.error-page p { margin: 1rem 0 2rem; color: var(--text-dim); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .hero-section h1 { font-size: 2rem; }
    .login-card { width: 100%; }
    .sites-table thead { display: none; }
    .sites-table { border-spacing: 0 8px; }
    .sites-table, .sites-table tbody, .sites-table tr, .sites-table td {
        display: block; width: 100%;
    }
    .sites-table tbody tr {
        padding: 16px;
        margin-bottom: 4px;
        border-radius: 12px;
    }
    .sites-table td {
        padding: 4px 0;
    }
    .sites-table td:last-child { margin-top: 8px; }
    .chat-panel { height: 420px; }
    .nav-inner { flex-wrap: wrap; gap: 10px; }
    .sites-header { flex-direction: column; align-items: flex-start; }
    .create-options { grid-template-columns: 1fr; }
}
