/* Agents directory + Teaching Agent page. Uses the site's edu-theme design
   tokens (static/css/edu-theme.css), not a bespoke palette — mirrors
   projects/history_tutor/history_tutor.css's own convention rather than
   site_concierge.css's older hardcoded-dark colors, which predate the
   "chalk" rebrand (see home_concierge.css's header comment for the same
   reasoning). */

.agents-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}

.agents-header {
    position: relative;
    text-align: center;
    margin-bottom: 32px;
}

.agents-back {
    position: absolute;
    left: 0;
    top: 4px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
}

.agents-back:hover {
    color: var(--accent-blue);
}

.agents-header h1 {
    font-size: 2.2rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.agents-header p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 640px;
    margin: 0 auto;
}

/* ---------- Directory page: agent cards ---------- */

.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.agent-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--secondary-dark);
    border: 1px solid var(--hairline);
    border-radius: 14px;
    padding: 22px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

a.agent-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--glass-shadow);
    border-color: var(--accent-blue);
}

.agent-card--soon {
    opacity: 0.6;
}

.agent-card-subject {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-green);
    font-weight: 600;
}

.agent-card h2 {
    font-size: 1.3rem;
    margin: 0;
    color: var(--text-primary);
}

.agent-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    flex: 1;
}

.agent-card-cta {
    font-weight: 600;
    color: var(--accent-deep);
    font-size: 0.9rem;
}

/* ---------- Teaching Agent page: chat ---------- */

.ta-chat {
    background: var(--secondary-dark);
    border: 1px solid var(--hairline);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    height: 60vh;
    min-height: 380px;
    max-height: 520px;
    overflow: hidden;
    margin-bottom: 40px;
}

.ta-chat .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ta-chat .message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.ta-chat .message-avatar {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--tertiary-dark);
    color: var(--accent-blue);
}

.ta-chat .message.user .message-avatar {
    background: var(--accent-blue);
    color: #fff;
}

.ta-chat .message-content {
    background: var(--tertiary-dark);
    padding: 10px 14px;
    border-radius: 10px;
    line-height: 1.5;
    max-width: 80%;
    color: var(--text-primary);
}

.ta-chat .message.user {
    flex-direction: row-reverse;
}

.ta-chat .message.user .message-content {
    background: var(--accent-blue);
    color: #fff;
}

.ta-chat .typing-indicator {
    display: flex;
    gap: 4px;
    padding: 2px 0;
}

.ta-chat .typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: ta-chat-blink 1.2s infinite ease-in-out;
}

.ta-chat .typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.ta-chat .typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ta-chat-blink {
    0%, 80%, 100% { opacity: 0.25; }
    40% { opacity: 1; }
}

.ta-chat .chat-input-area {
    display: flex;
    gap: 10px;
    padding: 14px;
    border-top: 1px solid var(--hairline);
}

.ta-chat .chat-input {
    flex: 1;
    resize: none;
    background: var(--primary-dark);
    border: 1px solid var(--hairline);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 0.95rem;
    font-family: inherit;
}

.ta-chat .chat-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.ta-chat .send-btn {
    background: var(--accent-blue);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0 20px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

.ta-chat .send-btn:hover {
    opacity: 0.9;
}

.ta-chat .send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ta-chat .chat-error {
    background: rgba(163, 31, 52, 0.1);
    border: 1px solid rgba(163, 31, 52, 0.35);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.85rem;
}

/* ---------- Teaching Agent page: static sections ---------- */

.ta-section {
    margin-bottom: 40px;
}

.ta-section h2 {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.ta-template-card {
    display: block;
    background: var(--secondary-dark);
    border: 1px solid var(--hairline);
    border-radius: 14px;
    padding: 22px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.ta-template-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--glass-shadow);
    border-color: var(--accent-blue);
}

.ta-template-eyebrow {
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-purple);
    font-weight: 600;
}

.ta-template-card h3 {
    font-size: 1.2rem;
    margin: 6px 0;
    color: var(--text-primary);
}

.ta-template-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.ta-template-cta {
    font-weight: 600;
    color: var(--accent-deep);
    font-size: 0.9rem;
}

.ta-resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.ta-resource-card {
    display: block;
    background: var(--secondary-dark);
    border: 1px solid var(--hairline);
    border-radius: 12px;
    padding: 16px 18px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, transform 0.2s;
}

.ta-resource-card:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

.ta-resource-type {
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-deep);
}

.ta-resource-card h3 {
    font-size: 1rem;
    color: var(--text-primary);
    margin: 4px 0;
}

.ta-resource-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

@media (max-width: 600px) {
    .ta-chat {
        height: 65vh;
    }

    /* .agents-back is absolutely positioned over the centered h1 (fine at
       desktop widths where "Teaching Agent" is short and there's room on
       either side); at narrow widths it overlaps the title text, so drop
       back to static flow and stack it above instead. */
    .agents-header {
        text-align: left;
    }

    .agents-back {
        position: static;
        display: inline-block;
        margin-bottom: 12px;
    }

    .agents-header h1,
    .agents-header p {
        text-align: left;
        margin-left: 0;
        margin-right: 0;
    }
}
