/* ============================================
   ChatGPT Agent Plugin - Frontend Styles
   ============================================ */

/* ---- License Gate ---- */
.cap-gate {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 420px;
    padding: 2rem 1rem;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.cap-gate__inner {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.08);
    padding: 2.5rem 2rem;
    max-width: 440px;
    width: 100%;
    text-align: center;
}

.cap-gate__icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.cap-gate__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.5rem 0;
}

.cap-gate__subtitle {
    color: #6b7280;
    font-size: 0.95rem;
    margin: 0 0 1.75rem 0;
}

.cap-gate__form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cap-gate__input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1.1rem;
    letter-spacing: 0.15em;
    text-align: center;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    font-family: 'Courier New', monospace;
}

.cap-gate__input:focus {
    border-color: #2563eb;
}

.cap-gate__btn {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.cap-gate__btn:hover {
    background: #1d4ed8;
}

.cap-gate__btn:active {
    transform: scale(0.98);
}

.cap-gate__btn:disabled {
    background: #93c5fd;
    cursor: not-allowed;
}

.cap-gate__error {
    color: #dc2626;
    font-size: 0.9rem;
    margin: 0;
    padding: 0.5rem 0.75rem;
    background: #fef2f2;
    border-radius: 6px;
}

.cap-gate__footer {
    margin: 1.5rem 0 0;
    font-size: 0.875rem;
    color: #9ca3af;
}

.cap-gate__footer a {
    color: #2563eb;
    text-decoration: none;
}

.cap-gate__footer a:hover {
    text-decoration: underline;
}

/* ---- Chat Agent ---- */
.cap-agent {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.07);
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: 600px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #fff;
}

.cap-agent__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: #1e40af;
    color: #fff;
}

.cap-agent__avatar {
    font-size: 1.75rem;
    line-height: 1;
}

.cap-agent__info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cap-agent__name {
    font-weight: 700;
    font-size: 1rem;
}

.cap-agent__status {
    font-size: 0.78rem;
    opacity: 0.8;
}

.cap-agent__status::before {
    content: '● ';
    color: #4ade80;
}

.cap-agent__logout {
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.35rem 0.6rem;
    transition: background 0.2s;
}

.cap-agent__logout:hover {
    background: rgba(255,255,255,0.3);
}

.cap-agent__messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    background: #f9fafb;
}

.cap-agent__message {
    display: flex;
}

.cap-agent__message--bot {
    justify-content: flex-start;
}

.cap-agent__message--user {
    justify-content: flex-end;
}

.cap-agent__bubble {
    max-width: 78%;
    padding: 0.7rem 1rem;
    border-radius: 14px;
    font-size: 0.95rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.cap-agent__message--bot .cap-agent__bubble {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
    color: #111827;
}

.cap-agent__message--user .cap-agent__bubble {
    background: #2563eb;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.cap-agent__message--typing .cap-agent__bubble {
    color: #9ca3af;
    font-style: italic;
}

.cap-agent__input-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

.cap-agent__textarea {
    flex: 1;
    resize: none;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    max-height: 120px;
    overflow-y: auto;
    transition: border-color 0.2s;
    line-height: 1.5;
}

.cap-agent__textarea:focus {
    border-color: #2563eb;
}

.cap-agent__send {
    background: #2563eb;
    border: none;
    border-radius: 10px;
    color: #fff;
    padding: 0.65rem 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.cap-agent__send:hover {
    background: #1d4ed8;
}

.cap-agent__send:disabled {
    background: #93c5fd;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 600px) {
    .cap-agent {
        height: 500px;
        border-radius: 12px;
    }
    .cap-gate__inner {
        padding: 1.75rem 1.25rem;
    }
}

/* Expiry label in agent header */
.cap-agent__expiry {
    font-size: 0.72rem;
    background: rgba(255,255,255,0.15);
    border-radius: 20px;
    padding: 3px 10px;
    opacity: 0.9;
    white-space: nowrap;
}
