/* Access Control Styles */

/* Banners */
.access-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    font-size: 14px;
    z-index: 1000;
}

.anonymous-banner {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 100%);
    color: #fff;
}

.trial-banner {
    background: linear-gradient(135deg, #1a4d2e 0%, #2d7a4d 100%);
    color: #fff;
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.banner-btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.banner-btn:hover {
    background: rgba(255,255,255,0.3);
}

.banner-btn.primary {
    background: #22c55e;
    border-color: #22c55e;
}

.banner-btn.primary:hover {
    background: #16a34a;
}

.banner-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 24px;
    cursor: pointer;
    padding: 0 8px;
}

.banner-close:hover {
    color: #fff;
}

/* Login Button */
.login-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: #333;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.login-btn img {
    width: 18px;
    height: 18px;
}

.login-btn:hover {
    background: #f5f5f5;
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    background: #4f46e5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    /* Neutralise native <button> chrome so the avatar control matches the prior div. */
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: #1e1e2e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    min-width: 200px;
    display: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.user-menu.open .user-dropdown {
    display: block;
}

.user-info {
    padding: 12px 16px;
}

.user-info strong {
    display: block;
    color: #fff;
}

.user-info span {
    font-size: 12px;
    color: #9ca3af;
}

.user-dropdown hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin: 0;
}

.user-dropdown a {
    display: block;
    padding: 10px 16px;
    color: #e5e7eb;
    text-decoration: none;
    font-size: 14px;
}

.user-dropdown a:hover {
    background: rgba(255,255,255,0.05);
}

/* Modal */
.access-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    animation: modal-fade-in 0.2s ease;
}

@keyframes modal-fade-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 24px;
    cursor: pointer;
}

.modal-content h2 {
    margin: 0 0 12px 0;
    color: #fff;
}

.modal-content p {
    color: #9ca3af;
    margin-bottom: 24px;
}

.google-signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #fff;
    color: #333;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: background 0.2s;
}

.google-signin-btn:hover {
    background: #f5f5f5;
}

.google-signin-btn img {
    width: 20px;
    height: 20px;
}

.trial-features {
    text-align: left;
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.trial-features li {
    padding: 8px 0;
    color: #e5e7eb;
}

.trial-features li::before {
    content: '\2713';
    color: #22c55e;
    margin-right: 10px;
}

.primary-btn {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #fff;
    border: none;
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-bottom: 16px;
}

.primary-btn:hover {
    opacity: 0.9;
}

.modal-footer {
    font-size: 12px !important;
    color: #6b7280 !important;
    margin: 0 !important;
}

/* Mobile: full-screen login & upgrade modals */
@media (max-width: 640px) {
    .access-modal .modal-content {
        box-sizing: border-box;
        max-width: 100%;
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        overflow-y: auto;
        padding-top: calc(32px + env(safe-area-inset-top, 0px));
        padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
        animation: none;
    }

    .access-modal .modal-backdrop {
        backdrop-filter: none;
    }
}

/* =====================
   DEMO SELECTOR - SINGLE COLUMN LAYOUT
   ===================== */
#demo-selector {
    margin: 16px 0;
    padding: 12px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
}

.demo-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.demo-header-icon {
    font-size: 16px;
}

.demo-header-text {
    color: #e2e8f0;
    font-weight: 500;
    font-size: 14px;
}

.demo-header-hint {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 400;
    margin-left: auto;
}

/* Single column grid */
.demo-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Compact horizontal cards */
.demo-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(51, 65, 85, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.demo-card:hover {
    background: rgba(71, 85, 105, 0.7);
    border-color: rgba(148, 163, 184, 0.4);
    transform: translateX(4px);
}

.demo-card.loading {
    opacity: 0.7;
    pointer-events: none;
}

.demo-card.hidden {
    display: none;
}

.demo-card-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139, 92, 246, 0.2);
    border-radius: 6px;
    font-size: 16px;
}

.demo-card-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.demo-card-name {
    color: #f1f5f9;
    font-size: 13px;
    font-weight: 500;
    /* Allow full text, no truncation */
    white-space: normal;
    overflow-wrap: break-word;
}

.demo-card-meta {
    color: #94a3b8;
    font-size: 11px;
}

/* Node count badge */
.demo-card-badge {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Show more button */
.demo-expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 4px;
    padding: 8px;
    background: transparent;
    border: 1px dashed rgba(255,255,255,0.15);
    border-radius: 8px;
    color: #94a3b8;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.demo-expand-btn:hover {
    background: rgba(255,255,255,0.05);
    color: #e2e8f0;
}

.demo-expand-btn .chevron {
    transition: transform 0.2s;
}

.demo-expand-btn.expanded .chevron {
    transform: rotate(180deg);
}

/* Demo loaded info in chat — styled to match normal AI messages */
.demo-loaded-desc {
    color: #cbd5e1;
    font-size: 14px;
    margin: 8px 0 12px 0;
}

.demo-loaded-prompt {
    background: rgba(0,0,0,0.2);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.demo-loaded-prompt-label {
    display: block;
    color: #94a3b8;
    font-size: 12px;
    margin-bottom: 4px;
}

.demo-loaded-prompt em {
    color: #e2e8f0;
    font-style: italic;
    font-size: 13px;
}

/* Legacy demo chips (backwards compatibility) */
#demo-chips {
    padding: 12px 16px;
    margin: 8px 0;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
}

.demo-chips-header {
    font-size: 13px;
    color: #9ca3af;
    margin-bottom: 10px;
}

.demo-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.demo-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: #e5e7eb;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.demo-chip:hover {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
    color: #fff;
    transform: translateY(-1px);
}

.demo-chip:active {
    transform: translateY(0);
}

/* Legacy demo selector (hidden) */
.demo-selector,
.demo-workflow-grid,
.demo-overlay,
.try-demo-section {
    display: none !important;
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 24px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    z-index: 10000;
    animation: slide-in 0.3s ease;
}

.toast-success {
    background: #22c55e;
}

.toast-error {
    background: #ef4444;
}

.toast-info {
    background: #3b82f6;
}

@keyframes slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* =====================
   DEMO TOAST NOTIFICATIONS
   ===================== */
.demo-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: toast-slide-in 0.3s ease;
}

.demo-toast-success { background: #22c55e; }
.demo-toast-error { background: #ef4444; }
.demo-toast-info { background: #3b82f6; }

.demo-toast.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
}

@keyframes toast-slide-in {
    from { transform: translateX(-50%) translateY(20px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* Tutorial Styles */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
    pointer-events: none;
}

.tutorial-tooltip {
    position: fixed;
    background: #1e293b;
    border: 1px solid #3b82f6;
    border-radius: 12px;
    padding: 16px 20px;
    max-width: min(360px, calc(100vw - 48px));
    z-index: 10001;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.tutorial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.tutorial-step {
    font-size: 12px;
    color: #9ca3af;
}

.tutorial-skip {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 12px;
}

.tutorial-skip:hover {
    color: #fff;
}

.tutorial-tooltip h4 {
    margin: 0 0 8px 0;
    color: #22c55e;
    font-size: 18px;
}

.tutorial-tooltip p {
    margin: 0 0 16px 0;
    color: #e5e7eb;
    font-size: 14px;
    line-height: 1.5;
}

.tutorial-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.tutorial-prev,
.tutorial-next {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.tutorial-prev {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: #e5e7eb;
}

.tutorial-prev:hover {
    border-color: rgba(255,255,255,0.4);
}

.tutorial-next {
    background: #22c55e;
    border: none;
    color: #fff;
    font-weight: 500;
}

.tutorial-next:hover {
    background: #16a34a;
}

.tutorial-highlight {
    position: relative;
    z-index: 9999;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.5);
    border-radius: 8px;
}
