/* ========================================
   AI Struxxa Demo Portal — Shared Styles
   ======================================== */

:root {
    --brand-blue: #1e3a5f;
    --brand-blue-hover: #15304f;
    --brand-dark: #1a1a2e;
    --brand-cream: #faf8f5;
    --brand-teal: #2dd4bf;
    --brand-red: #c0392b;
    --brand-light-gray: #f5f5f7;
    --brand-card-bg: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #555;
    --text-muted: #888;
    --border: #e8e6e1;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--brand-cream);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===== LOGIN GATE ===== */
#login-gate {
    position: fixed; inset: 0; z-index: 9999;
    background: var(--brand-cream);
    display: flex; align-items: center; justify-content: center;
}
#login-gate.hidden { display: none; }

.login-box {
    background: white; border-radius: var(--radius-lg); padding: 48px;
    box-shadow: var(--shadow-lg); text-align: center; max-width: 420px; width: 90%;
}
.login-box img { height: 44px; margin-bottom: 24px; }
.login-box h2 { font-size: 1.25rem; font-weight: 700; color: var(--brand-dark); margin-bottom: 8px; }
.login-box p { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 24px; }
.login-box input {
    width: 100%; padding: 14px 16px; border: 2px solid var(--border); border-radius: 10px;
    font-size: 1rem; font-family: inherit; outline: none; transition: border-color 0.2s;
}
.login-box input:focus { border-color: var(--brand-blue); }
.login-box .btn-login {
    width: 100%; margin-top: 16px; padding: 14px; border: none; border-radius: 10px;
    background: var(--brand-blue); color: white; font-size: 1rem; font-weight: 600;
    font-family: inherit; cursor: pointer; transition: background 0.2s;
}
.login-box .btn-login:hover { background: var(--brand-blue-hover); }
.login-error { color: var(--brand-red); font-size: 0.85rem; margin-top: 8px; display: none; }

/* ===== HEADER ===== */
header {
    background: rgba(255,255,255,0.95); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
}
.header-inner {
    max-width: 1280px; margin: 0 auto; padding: 0 48px;
    display: flex; align-items: center; justify-content: space-between; height: 64px;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-left img { height: 36px; }
.header-badge {
    font-size: 0.7rem; font-weight: 700; color: var(--brand-blue);
    letter-spacing: 1.5px; text-transform: uppercase;
    background: rgba(30,58,95,0.07); padding: 5px 12px; border-radius: 6px;
}
header nav { display: flex; gap: 4px; align-items: center; }
header nav a {
    text-decoration: none; color: var(--text-secondary); font-size: 0.82rem;
    font-weight: 500; padding: 7px 12px; border-radius: 8px; transition: all 0.2s;
    white-space: nowrap;
}
header nav a:hover, header nav a.active {
    color: var(--brand-blue); background: rgba(30,58,95,0.06);
}

/* ===== HERO ===== */
.hero {
    position: relative; overflow: hidden;
    padding: 72px 48px 56px;
    background: linear-gradient(135deg, var(--brand-cream) 0%, #eef2f7 100%);
}
.hero::before {
    content: ''; position: absolute; inset: 0; opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%231e3a5f' fill-opacity='1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-inner {
    max-width: 1200px; margin: 0 auto; display: grid;
    grid-template-columns: 1fr 1fr; gap: 48px; align-items: center;
    position: relative; z-index: 1;
}
.hero h1 {
    font-size: 2.8rem; font-weight: 900; line-height: 1.12;
    color: var(--brand-dark); letter-spacing: -0.5px;
}
.hero h1 span { color: var(--brand-red); }
.hero .hero-text {
    margin-top: 20px; font-size: 1.05rem; color: var(--text-secondary);
    max-width: 480px; line-height: 1.7;
}
.hero-img {
    width: 100%; max-width: 500px; border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg); object-fit: cover; aspect-ratio: 4/3;
}

/* ===== TOOLS SECTION ===== */
.tools-section { padding: 72px 48px; max-width: 1200px; margin: 0 auto; }
.tools-section h2 {
    text-align: center; font-size: 1.8rem; font-weight: 800;
    color: var(--brand-dark); margin-bottom: 12px;
}
.tools-section .subtitle {
    text-align: center; font-size: 0.95rem; color: var(--text-secondary);
    max-width: 580px; margin: 0 auto 48px; line-height: 1.7;
}
.tools-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.tools-grid-bottom {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px;
    max-width: 780px; margin: 20px auto 0;
}

/* ===== TOOL CARD ===== */
.tool-card {
    background: var(--brand-card-bg); border-radius: var(--radius-lg);
    padding: 28px 24px; box-shadow: var(--shadow-sm);
    transition: all 0.3s ease; cursor: pointer; text-decoration: none; color: inherit;
    display: flex; flex-direction: column; gap: 10px;
    border: 1px solid rgba(0,0,0,0.04);
}
.tool-card:hover {
    box-shadow: var(--shadow-md); transform: translateY(-3px);
    border-color: rgba(30,58,95,0.15);
}
.tool-card-icon {
    width: 44px; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; color: white;
}
.tool-card h3 { font-size: 0.95rem; font-weight: 700; color: var(--brand-dark); }
.tool-card p { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.6; flex: 1; }
.status-badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.72rem; font-weight: 600; padding: 3px 10px;
    border-radius: 20px; width: fit-content;
}
.status-live { background: #e6f9f0; color: #0d7a3e; }
.status-testing { background: #fff3e0; color: #e65100; }
.status-soon { background: #f0f0f5; color: #888; }

/* ===== PAGE LAYOUT (sub pages) ===== */
.page-container {
    max-width: 1280px; margin: 0 auto; padding: 32px 48px;
}
.page-title-bar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.page-title-bar h1 { font-size: 1.5rem; font-weight: 800; color: var(--brand-dark); }
.btn-back {
    display: inline-flex; align-items: center; gap: 6px;
    text-decoration: none; color: var(--text-secondary); font-size: 0.85rem;
    font-weight: 500; padding: 8px 16px; border-radius: 8px;
    border: 1.5px solid var(--border); transition: all 0.2s;
}
.btn-back:hover { border-color: var(--brand-blue); color: var(--brand-blue); }
.btn-back svg { width: 16px; height: 16px; }

/* ===== IFRAME WRAPPER ===== */
.iframe-wrapper {
    background: white; border-radius: var(--radius-lg); overflow: hidden;
    box-shadow: var(--shadow-md); border: 1px solid var(--border);
}
.iframe-wrapper iframe {
    width: 100%; height: calc(100vh - 180px); border: none; display: block;
}

/* ===== CHATBOT PAGE ===== */
.chat-layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; }
.chat-main {
    background: white; border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
    display: flex; flex-direction: column; height: calc(100vh - 180px);
}
.chat-messages {
    flex: 1; overflow-y: auto; padding: 24px;
    display: flex; flex-direction: column; gap: 16px;
}
.chat-input-bar {
    padding: 16px 24px; border-top: 1px solid var(--border);
    display: flex; gap: 12px; align-items: center;
}
.chat-input-bar input {
    flex: 1; padding: 12px 16px; border: 1.5px solid var(--border);
    border-radius: 10px; font-size: 0.95rem; font-family: inherit; outline: none;
    transition: border-color 0.2s;
}
.chat-input-bar input:focus { border-color: var(--brand-blue); }
.chat-input-bar button {
    padding: 12px 20px; background: var(--brand-blue); color: white;
    border: none; border-radius: 10px; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: background 0.2s; white-space: nowrap;
}
.chat-input-bar button:hover { background: var(--brand-blue-hover); }
.chat-input-bar button:disabled { opacity: 0.5; cursor: not-allowed; }

.msg { max-width: 80%; padding: 12px 16px; border-radius: 12px; font-size: 0.92rem; line-height: 1.6; }
.msg-user { background: var(--brand-blue); color: white; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg-bot { background: var(--brand-light-gray, #f0f0f5); color: var(--text-primary); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg-typing { font-style: italic; color: var(--text-muted); }

/* ===== SIDEBAR (upload) ===== */
.chat-sidebar {
    display: flex; flex-direction: column; gap: 16px;
}
.sidebar-card {
    background: white; border-radius: var(--radius-lg); padding: 24px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.sidebar-card h3 {
    font-size: 0.95rem; font-weight: 700; color: var(--brand-dark); margin-bottom: 8px;
}
.sidebar-card p { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.6; }

.upload-zone {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 24px; text-align: center; cursor: pointer;
    transition: all 0.2s; background: var(--brand-cream);
}
.upload-zone:hover { border-color: var(--brand-blue); background: rgba(30,58,95,0.03); }
.upload-zone svg { margin-bottom: 8px; color: var(--text-muted); }
.upload-zone .upload-label { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.upload-zone .upload-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

.upload-progress { display: none; margin-top: 12px; }
.upload-progress .progress-bar {
    height: 6px; background: #e0e0e0; border-radius: 3px; overflow: hidden;
}
.upload-progress .progress-fill {
    height: 100%; background: var(--brand-blue); border-radius: 3px;
    transition: width 0.3s ease; width: 0%;
}
.upload-progress .progress-text {
    font-size: 0.78rem; color: var(--text-secondary); margin-top: 6px; text-align: center;
}
.upload-success { color: #0d7a3e; font-size: 0.82rem; font-weight: 500; margin-top: 8px; display: none; }
.upload-error { color: var(--brand-red); font-size: 0.82rem; font-weight: 500; margin-top: 8px; display: none; }

/* ===== PLACEHOLDER PAGE ===== */
.placeholder-content {
    background: white; border-radius: var(--radius-lg); padding: 64px 48px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
    text-align: center; max-width: 700px; margin: 0 auto;
}
.placeholder-content .placeholder-icon {
    width: 80px; height: 80px; border-radius: 20px; margin: 0 auto 24px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(30,58,95,0.06); color: var(--brand-blue);
}
.placeholder-content h2 { font-size: 1.4rem; font-weight: 800; color: var(--brand-dark); margin-bottom: 12px; }
.placeholder-content p { font-size: 0.95rem; color: var(--text-secondary); line-height: 1.7; max-width: 500px; margin: 0 auto; }
.placeholder-content .coming-soon-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(30,58,95,0.06); color: var(--brand-blue);
    font-size: 0.8rem; font-weight: 600; padding: 8px 16px;
    border-radius: 20px; margin-top: 24px;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-box {
    background: white; border-radius: var(--radius-lg); padding: 32px;
    max-width: 440px; width: 90%; box-shadow: var(--shadow-lg); text-align: center;
}
.modal-box h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.modal-box p { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 24px; }
.modal-box .filename { font-weight: 600; color: var(--brand-blue); }
.modal-actions { display: flex; gap: 12px; justify-content: center; }
.modal-actions button {
    padding: 10px 28px; border-radius: 10px; font-size: 0.9rem; font-weight: 600;
    font-family: inherit; cursor: pointer; transition: all 0.2s;
}
.btn-confirm {
    background: var(--brand-blue); color: white; border: none;
}
.btn-confirm:hover { background: var(--brand-blue-hover); }
.btn-cancel {
    background: white; color: var(--text-secondary); border: 1.5px solid var(--border);
}
.btn-cancel:hover { border-color: var(--brand-blue); color: var(--brand-blue); }

/* ===== FOOTER ===== */
footer {
    text-align: center; padding: 24px 48px; color: var(--text-muted);
    font-size: 0.8rem; border-top: 1px solid var(--border); background: white;
    margin-top: 48px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .chat-layout { grid-template-columns: 1fr; }
    .chat-main { height: 60vh; }
}
@media (max-width: 900px) {
    .header-inner { padding: 0 20px; }
    header nav { display: none; }
    .hero { padding: 48px 20px 36px; }
    .hero-inner { grid-template-columns: 1fr; text-align: center; }
    .hero h1 { font-size: 2rem; }
    .hero .hero-text { margin: 12px auto 0; }
    .hero-img { max-width: 380px; margin: 0 auto; }
    .tools-section { padding: 48px 20px; }
    .tools-grid, .tools-grid-bottom { grid-template-columns: 1fr; }
    .page-container { padding: 20px; }
}
