/* ============================================================
   Intent Boxes – Main Stylesheet
   Research & Innovation palette:
     Primary:   #3F51B5 (Indigo)
     Accent:    #00BCD4 (Cyan)
     Surface:   #FFFFFF
     Text:      #263238
     Muted:     #78909C
     Border:    #ECEFF1
     Danger:    #E53935
   ============================================================ */

:root {
    --primary: #3F51B5;
    --primary-light: #7986CB;
    --primary-dark: #283593;
    --accent: #00BCD4;
    --accent-light: #4DD0E1;
    --surface: #FFFFFF;
    --background: #F5F7FA;
    --text: #263238;
    --text-secondary: #546E7A;
    --muted: #78909C;
    --border: #ECEFF1;
    --border-strong: #CFD8DC;
    --danger: #E53935;
    --danger-light: #FFEBEE;
    --success: #43A047;
    --success-light: #E8F5E9;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.10);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

/* ── Header ────────────────────────────────────────────────── */

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.logo {
    font-size: 1.25rem;
    font-weight: 800;
    text-decoration: none;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--accent);
    font-weight: 600;
}

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

.header-login-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.header-login-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* User pill (logged in state) */
.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 4px 12px 4px 4px;
}

.user-pill img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.user-info-text {
    line-height: 1.2;
    text-align: left;
}

.user-info-text .user-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text);
}

.user-info-text .user-email {
    font-size: 0.75rem;
    color: var(--muted);
}

.logout-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s;
}

.logout-btn:hover {
    background: var(--border);
}

/* ── Hero ──────────────────────────────────────────────────── */

.hero {
    text-align: center;
    padding: 64px 0 24px;
}

.hero h1 {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: -1px;
    margin-bottom: 12px;
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto;
}

/* ── Auth Section ──────────────────────────────────────────── */

.auth-section {
    max-width: 600px;
    margin: 0 auto 3rem;
    text-align: center;
}

.public-info {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.public-info h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.75rem;
}

.public-info p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.info-list {
    list-style: none;
    display: grid;
    gap: 0.5rem;
}

.info-list li {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding-left: 1.2rem;
    position: relative;
}

.info-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.auth-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 14px 40px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: var(--shadow-md);
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.verify-msg {
    text-align: center;
    background: #FFF3E0;
    color: #EF6C00;
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    font-weight: 600;
}

/* ── Panel Content ─────────────────────────────────────────── */

.panel-content {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.panel-content.visible {
    display: block;
    opacity: 1;
}

/* ── Key Setup ─────────────────────────────────────────────── */

.key-setup-section {
    margin-bottom: 2rem;
}

.key-setup-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow-sm);
}

.key-setup-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0.75rem;
}

.key-setup-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.key-progress {
    margin-top: 1rem;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--primary));
    border-radius: 3px;
    width: 0%;
    transition: width 0.4s ease;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 6px;
    display: inline-block;
}

.key-status-ready {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--success-light);
    border-radius: var(--radius-sm);
    color: var(--success);
    font-weight: 600;
    font-size: 0.9rem;
}

/* ── Sections ──────────────────────────────────────────────── */

.section-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 1rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.content-section {
    margin-bottom: 3rem;
}

/* ── Chatrooms ─────────────────────────────────────────────── */

.chatrooms-section {
    margin-bottom: 3rem;
}

.chatrooms-list {
    display: grid;
    gap: 10px;
}

.chatroom-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
    cursor: default;
}

.chatroom-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.chatroom-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 700;
}

.chatroom-info {
    flex: 1;
    min-width: 0;
}

.chatroom-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chatroom-meta {
    font-size: 0.8rem;
    color: var(--muted);
}

/* ── Graphs List ───────────────────────────────────────────── */

.graphs-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.graph-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.graph-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.graph-card-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    margin-bottom: 6px;
}

.graph-card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.graph-card-meta {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--muted);
}

.graph-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--border);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ── Empty state ───────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
    font-size: 0.95rem;
    grid-column: 1 / -1;
}

/* ── Buttons ───────────────────────────────────────────────── */

.action-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.action-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: none;
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-danger:hover {
    background: #C62828;
}

/* ── Icon Placeholder ──────────────────────────────────────── */

.icon-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--primary);
    background: rgba(63, 81, 181, 0.08);
    border-radius: 4px;
    flex-shrink: 0;
}

/* ── Modal ─────────────────────────────────────────────────── */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(38, 50, 56, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.modal.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius-lg);
    max-width: 480px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.modal-box-wide {
    max-width: 600px;
}

.modal-box h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--text);
}

.modal-btns {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 1.5rem;
}

/* ── Form ──────────────────────────────────────────────────── */

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    letter-spacing: 0.3px;
}

.form-group input[type="text"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(63, 81, 181, 0.08);
}

.form-group input[type="color"] {
    width: 48px;
    height: 36px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 2px;
}

/* ── Footer ────────────────────────────────────────────────── */

footer {
    margin-top: auto;
    padding: 2rem 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
}

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 700px) {
    .hero h1 { font-size: 1.8rem; }
    .header-content { height: 48px; }
    .container { padding: 0 16px; }
    .graphs-list { grid-template-columns: 1fr; }
}
