/* ============================================
   x1010 Platform CSS — top-line, popup, auth, site-creator, cookie-banner
   ============================================ */

:root {
    --pl-primary: #2563eb;
    --pl-primary-dark: #1d4ed8;
    --pl-danger: #dc2626;
    --pl-success: #16a34a;
    --pl-warning: #d97706;
    --pl-gray-50: #f9fafb;
    --pl-gray-100: #f3f4f6;
    --pl-gray-200: #e5e7eb;
    --pl-gray-400: #9ca3af;
    --pl-gray-600: #4b5563;
    --pl-gray-700: #374151;
    --pl-gray-900: #111827;
    --pl-white: #ffffff;
    --pl-shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
    --pl-shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
    --pl-z-topline: 1000;
    --pl-z-popup: 2000;
    --pl-topline-h: 52px;
}

/* ============================================
   Top-line
   ============================================ */

.top-line {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--pl-topline-h);
    background: rgba(15,23,42,.94);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: var(--pl-z-topline);
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.top-line__logo {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: .5px;
}
.top-line__logo span { color: #60a5fa; }

.top-line__right {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

/* Auth buttons */
.top-line-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
    border: none;
    text-decoration: none;
    white-space: nowrap;
}
.top-line-btn--ghost {
    background: transparent;
    color: rgba(255,255,255,.85);
    border: 1px solid rgba(255,255,255,.18);
}
.top-line-btn--ghost:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}
.top-line-btn--primary {
    background: var(--pl-primary);
    color: #fff;
}
.top-line-btn--primary:hover { background: var(--pl-primary-dark); }

.top-line-btn--cta {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #fff;
}
.top-line-btn--cta:hover { opacity: .9; }

/* Dropdown */
.top-line-dropdown {
    position: relative;
    display: inline-block;
}

.top-line-dropdown__toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: rgba(255,255,255,.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,.14);
    transition: all .2s;
    white-space: nowrap;
}
.top-line-dropdown__toggle:hover { background: rgba(255,255,255,.18); }
.top-line-dropdown__toggle .chevron {
    font-size: 10px;
    transition: transform .2s;
    opacity: .7;
}
.top-line-dropdown.open .chevron { transform: rotate(180deg); }

.top-line-dropdown__menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 220px;
    background: var(--pl-white);
    border: 1px solid var(--pl-gray-200);
    border-radius: 10px;
    box-shadow: var(--pl-shadow-lg);
    padding: 6px;
    z-index: calc(var(--pl-z-topline) + 10);
    animation: plFadeIn .15s ease;
}
.top-line-dropdown.open .top-line-dropdown__menu { display: block; }

.top-line-dropdown__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--pl-gray-700);
    cursor: pointer;
    transition: background .15s;
    text-decoration: none;
    white-space: nowrap;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
}
.top-line-dropdown__item:hover { background: var(--pl-gray-100); color: var(--pl-gray-900); }
.top-line-dropdown__item--action { color: var(--pl-primary); font-weight: 500; }
.top-line-dropdown__item--danger  { color: var(--pl-danger); }
.top-line-dropdown__divider {
    border: none;
    border-top: 1px solid var(--pl-gray-200);
    margin: 4px 0;
}

@keyframes plFadeIn {
    from { opacity:0; transform:translateY(-4px); }
    to   { opacity:1; transform:translateY(0); }
}

/* ============================================
   Buttons (shared with popup/forms)
   ============================================ */

.pl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
    border: 1px solid transparent;
    font-family: inherit;
}
.pl-btn--primary { background: var(--pl-primary); color: #fff; }
.pl-btn--primary:hover { background: var(--pl-primary-dark); }
.pl-btn--secondary { background: transparent; color: var(--pl-gray-700); border-color: var(--pl-gray-200); }
.pl-btn--secondary:hover { background: var(--pl-gray-100); }
.pl-btn--danger { background: var(--pl-danger); color: #fff; }
.pl-btn:disabled { opacity: .55; pointer-events: none; }
.pl-btn--block { width: 100%; }

/* ============================================
   Popup
   ============================================ */

.pl-popup {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(2px);
    z-index: var(--pl-z-popup);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .25s;
}
.pl-popup.active {
    display: flex;
    opacity: 1;
}
.pl-popup__content {
    background: var(--pl-white);
    border-radius: 14px;
    box-shadow: 0 24px 48px rgba(15,23,42,.22);
    border: 1px solid #dbe3ee;
    max-width: 520px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: plSlideUp .3s ease;
}
@keyframes plSlideUp {
    from { transform:translateY(20px); opacity:0; }
    to   { transform:translateY(0); opacity:1; }
}
.pl-popup__header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--pl-gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg,#fff 0%,#f8fafc 100%);
}
.pl-popup__title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}
.pl-popup__close {
    width: 32px; height: 32px;
    border: none; background: transparent; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px; color: var(--pl-gray-600); font-size: 20px;
    transition: all .2s;
}
.pl-popup__close:hover { background: var(--pl-gray-100); color: var(--pl-gray-900); }
.pl-popup__body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    background: #fff;
}
.pl-popup__footer {
    padding: 16px 24px;
    border-top: 1px solid var(--pl-gray-200);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: #f8fafc;
}

/* ============================================
   Forms
   ============================================ */

.pl-form-group { margin-bottom: 18px; }
.pl-form-group:last-child { margin-bottom: 0; }
.pl-form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--pl-gray-700);
    margin-bottom: 5px;
}
.pl-form-input, .pl-form-select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d2dcea;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--pl-gray-900);
    background: #fff;
    transition: all .2s;
    box-sizing: border-box;
}
.pl-form-input:focus, .pl-form-select:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14,165,233,.14);
}
.pl-form-input--error { border-color: var(--pl-danger) !important; }
.pl-form-hint { font-size: 12px; color: var(--pl-gray-400); margin-top: 4px; display: block; }
.pl-form-error { font-size: 12px; color: var(--pl-danger); margin-top: 4px; display: block; }
.pl-form-success { font-size: 12px; color: var(--pl-success); margin-top: 4px; display: block; }

.pl-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--pl-gray-200);
    margin-bottom: 20px;
}
.pl-tab {
    padding: 8px 16px;
    border: none; background: transparent;
    font-size: 14px; font-weight: 500; cursor: pointer;
    color: var(--pl-gray-600);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all .2s;
}
.pl-tab.active { color: var(--pl-primary); border-bottom-color: var(--pl-primary); }
.pl-tab-panel { display: none; }
.pl-tab-panel.active { display: block; }

/* ============================================
   Auth popup specific
   ============================================ */

.auth-message {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    display: none;
}
.auth-message.error   { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; display: block; }
.auth-message.success { background: #f0fdf4; color: #166534; border: 1px solid #86efac; display: block; }

/* ============================================
   Site Creator form
   ============================================ */

.sc-subdomain-row {
    display: flex;
    align-items: center;
    gap: 0;
}
.sc-subdomain-row .pl-form-input {
    border-radius: 8px 0 0 8px;
    flex: 1;
}
.sc-subdomain-suffix {
    padding: 9px 12px;
    background: var(--pl-gray-100);
    border: 1px solid #d2dcea;
    border-left: none;
    border-radius: 0 8px 8px 0;
    font-size: 13px;
    color: var(--pl-gray-600);
    white-space: nowrap;
}

.sc-themes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 6px;
}
.sc-theme-card {
    border: 2px solid var(--pl-gray-200);
    border-radius: 10px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all .2s;
    background: var(--pl-white);
}
.sc-theme-card:hover { border-color: #93c5fd; background: #f8faff; }
.sc-theme-card.selected { border-color: var(--pl-primary); background: #eff6ff; }
.sc-theme-card__label {
    font-size: 14px;
    font-weight: 600;
    color: var(--pl-gray-900);
    margin-bottom: 4px;
}
.sc-theme-card.selected .sc-theme-card__label { color: var(--pl-primary); }
.sc-theme-card__desc {
    font-size: 12px;
    color: var(--pl-gray-600);
    line-height: 1.4;
}

.sc-success {
    text-align: center;
    padding: 16px 0;
}
.sc-success__icon { font-size: 56px; margin-bottom: 12px; }
.sc-success__title { font-size: 20px; font-weight: 700; color: var(--pl-gray-900); margin-bottom: 8px; }
.sc-success__desc { font-size: 14px; color: var(--pl-gray-600); margin-bottom: 20px; line-height: 1.5; }
.sc-success__url {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    background: var(--pl-gray-100);
    border-radius: 8px;
    font-size: 13px; font-family: monospace;
    color: var(--pl-primary); font-weight: 500;
    text-decoration: none;
    border: 1px solid var(--pl-gray-200);
    margin-bottom: 20px;
    word-break: break-all;
}
.sc-success__url:hover { background: #dbeafe; }

/* ============================================
   Cookie Banner
   ============================================ */

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15,23,42,.96);
    color: rgba(255,255,255,.9);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    z-index: 9999;
    font-size: 13px;
    flex-wrap: wrap;
    backdrop-filter: blur(4px);
    border-top: 1px solid rgba(255,255,255,.08);
}
.cookie-banner__text { flex: 1; min-width: 200px; line-height: 1.5; }
.cookie-banner__text a { color: #60a5fa; }
.cookie-banner__btn {
    padding: 8px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    background: var(--pl-primary);
    color: #fff;
    transition: background .2s;
    white-space: nowrap;
}
.cookie-banner__btn:hover { background: var(--pl-primary-dark); }

/* ============================================
   Spinner
   ============================================ */

.pl-spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--pl-gray-200);
    border-top-color: var(--pl-primary);
    border-radius: 50%;
    animation: plSpin .65s linear infinite;
    margin: 40px auto;
}
@keyframes plSpin { to { transform:rotate(360deg); } }

/* ============================================
   Mobile
   ============================================ */

@media (max-width: 600px) {
    .top-line { padding: 0 16px; }
    .pl-popup__content {
        max-width: 100%; width: 100%;
        height: 100%; max-height: 100%;
        border-radius: 0;
    }
    .pl-popup__footer { flex-direction: column-reverse; }
    .pl-popup__footer .pl-btn { width: 100%; }
    .cookie-banner { flex-direction: column; align-items: flex-start; }
}
