/* Explain: Styling for the "Career Assistant" chat window and its components. */
/* وظيفتك — نافذة «المساعد المهني» للدردشة الذكية */

.chat-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    border: 0;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.chat-toggle {
    position: fixed;
    inset-inline-end: 1.25rem;
    inset-inline-start: auto;
    bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    z-index: 75;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 3rem;
    padding: 0 1.05rem;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary-color), var(--sage-dark));
    color: var(--background-color);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    box-shadow: 0 18px 44px rgba(31, 46, 35, 0.28);
    transition: transform 300ms ease, box-shadow 300ms ease;
    cursor: pointer;
}

.chat-toggle:hover {
    transform: translateY(-3px);
    box-shadow: 0 24px 54px rgba(31, 46, 35, 0.34);
}

.chat-toggle[hidden] {
    display: none;
}

.chat-toggle i {
    font-size: 1.15rem;
}

.chat-toggle-label {
    display: none;
}

@media (min-width: 640px) {
    .chat-toggle-label {
        display: inline;
    }
}

.chat-box:focus-visible,
.chat-panel button:focus-visible,
.chat-panel a:focus-visible,
.chat-panel textarea:focus-visible,
.chat-toggle:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.chat-panel {
    position: fixed;
    inset-inline-end: 1.25rem;
    inset-inline-start: auto;
    bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    z-index: 90;
    display: flex;
    flex-direction: column;
    width: min(24rem, calc(100vw - 2.5rem));
    max-height: min(34rem, calc(100dvh - 2.5rem));
    overflow: hidden;
    border: 1px solid var(--glass-border);
    border-radius: 1.75rem;
    background: var(--background-color);
    color: var(--text-color);
    box-shadow: 0 34px 90px rgba(31, 46, 35, 0.26);
}

.chat-panel[hidden] {
    display: none;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--sage-dark));
    color: var(--background-color);
}

.chat-header-icon {
    display: inline-flex;
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 1.05rem;
}

.chat-header-text {
    flex: 1;
    min-width: 0;
}

.chat-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
}

.chat-subtitle {
    margin: 0.15rem 0 0;
    font-size: 0.72rem;
    line-height: 1.5;
    opacity: 0.88;
}

.chat-header-actions {
    display: inline-flex;
    flex-shrink: 0;
    gap: 0.35rem;
}

.chat-icon-btn {
    display: inline-flex;
    width: 2.25rem;
    height: 2.25rem;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    color: inherit;
    cursor: pointer;
    transition: background 300ms ease;
}

.chat-icon-btn:hover {
    background: rgba(255, 255, 255, 0.32);
}

.chat-messages {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 8rem;
    overflow-y: auto;
    padding: 1rem;
}

.chat-intro {
    border: 1px dashed var(--glass-border);
    border-radius: 1.25rem;
    background: var(--surface-color);
    padding: 0.9rem 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.9;
}

.chat-col {
    display: grid;
    gap: 0.5rem;
}

.chat-col-user {
    justify-items: end;
}

.chat-col-assistant {
    justify-items: start;
}

.chat-bubble {
    max-width: 92%;
    border-radius: 1.15rem;
    padding: 0.7rem 0.95rem;
    font-size: 0.875rem;
    line-height: 1.9;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.chat-bubble strong {
    font-weight: 700;
}

.chat-bubble.user {
    border-end-end-radius: 0.35rem;
    background: var(--primary-color);
    color: var(--background-color);
}

.chat-bubble.assistant {
    border: 1px solid var(--border-color);
    border-end-start-radius: 0.35rem;
    background: var(--surface-color);
    color: var(--text-color);
}

.chat-jobs {
    display: grid;
    width: 100%;
    gap: 0.4rem;
}

.chat-jobs-title {
    margin: 0;
    color: var(--sage-dark);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.chat-job {
    display: grid;
    gap: 0.15rem;
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    background: var(--background-color);
    padding: 0.6rem 0.85rem;
    text-decoration: none;
    transition: border-color 300ms ease, background 300ms ease;
}

.chat-job:hover {
    border-color: var(--accent-color);
    background: var(--surface-color);
}

.chat-job-title {
    color: var(--text-color);
    font-size: 0.85rem;
    font-weight: 700;
}

.chat-job-meta {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.chat-dots {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.chat-dots span {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 999px;
    background: var(--text-muted);
    opacity: 0.45;
    animation: chatBounce 1.1s infinite ease-in-out;
}

.chat-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.chat-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes chatBounce {
    0%, 80%, 100% {
        opacity: 0.4;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-0.28rem);
    }
}

.chat-starters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0 1rem 0.75rem;
}

.chat-starters[hidden] {
    display: none;
}

.chat-starter {
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    background: var(--surface-color);
    padding: 0.45rem 0.85rem;
    color: var(--text-color);
    font-size: 0.78rem;
    font-weight: 600;
    text-align: start;
    cursor: pointer;
    transition: border-color 300ms ease, background 300ms ease;
}

.chat-starter:hover {
    border-color: var(--accent-color);
    background: var(--sage-soft);
}

.chat-composer {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--background-color);
    padding: 0.75rem;
}

.chat-textarea {
    flex: 1;
    min-height: 2.75rem;
    max-height: 7.5rem;
    resize: none;
    border: 1px solid var(--glass-border);
    border-radius: 1.25rem;
    background: var(--field-bg);
    padding: 0.7rem 0.95rem;
    color: var(--text-color);
    font-family: var(--font-body);
    font-size: 0.875rem;
    line-height: 1.7;
}

.chat-textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.75;
}

.chat-textarea:disabled {
    opacity: 0.6;
}

.chat-send {
    display: inline-flex;
    width: 2.75rem;
    height: 2.75rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: var(--button-color);
    color: var(--text-color);
    font-size: 1rem;
    cursor: pointer;
    transition: background 300ms ease;
}

.chat-send:hover {
    background: var(--primary-hover);
}

.chat-send:disabled {
    opacity: 0.55;
    cursor: default;
}

@media print {
    .chat-root {
        display: none !important;
    }
}