/* =====================================================
   Çalışkan Ofis AI Chatbot — Modern Light Theme
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Sıcak & premium amber→turuncu tema (Çalışkan Ofis marka uyumlu) */
    --cofis-primary: #EA580C;
    --cofis-primary-hover: #C2410C;
    --cofis-primary-soft: #FFF7ED;
    --cofis-accent: #F59E0B;
    --cofis-gradient: linear-gradient(135deg, #F59E0B 0%, #F97316 52%, #EA580C 100%);
    --cofis-gradient-soft: linear-gradient(135deg, #FFF7ED 0%, #FFFBEB 100%);

    --cofis-text: #2A2118;        /* sıcak koyu ton */
    --cofis-text-muted: #7C6F63;
    --cofis-text-subtle: #A99C8E;

    --cofis-bg: #FFFFFF;
    --cofis-bg-soft: #FFFBF5;     /* hafif krem — sıcaklık */
    --cofis-bg-elev: #FFFFFF;

    --cofis-border: #EFE6DB;      /* sıcak kenarlık */
    --cofis-border-soft: #F6EEE5;

    --cofis-success: #10B981;     /* çevrimiçi noktası — yeşil kalır */

    --cofis-shadow-sm: 0 1px 2px rgba(120, 72, 20, 0.06);
    --cofis-shadow-md: 0 4px 12px rgba(120, 72, 20, 0.08);
    --cofis-shadow-lg: 0 20px 50px rgba(60, 38, 12, 0.14), 0 10px 24px rgba(234, 88, 12, 0.12);
    --cofis-shadow-btn: 0 10px 28px rgba(234, 88, 12, 0.40);

    --cofis-radius-sm: 10px;
    --cofis-radius-md: 14px;
    --cofis-radius-lg: 20px;
    --cofis-radius-xl: 24px;

    --cofis-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* =====================================================
   Floating Action Button
   ===================================================== */

#cofis-chat-btn {
    position: fixed;
    right: 24px;
    bottom: 100px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--cofis-gradient);
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--cofis-shadow-btn);
    transition: transform 0.25s var(--cofis-ease), box-shadow 0.25s var(--cofis-ease);
}

#cofis-chat-btn::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: var(--cofis-gradient);
    opacity: 0.25;
    filter: blur(10px);
    z-index: -1;
    transition: opacity 0.25s var(--cofis-ease);
}

#cofis-chat-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 14px 36px rgba(234, 88, 12, 0.5);
}

#cofis-chat-btn:hover::before {
    opacity: 0.45;
}

#cofis-chat-btn svg {
    width: 27px;
    height: 27px;
    fill: #FFFFFF;
    stroke: none;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.18));
}

/* Pulse ring (idle attention) */
#cofis-chat-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.5);
    animation: cofisPulse 2.4s ease-out infinite;
    pointer-events: none;
}

@keyframes cofisPulse {
    0%   { box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.4); }
    70%  { box-shadow: 0 0 0 18px rgba(234, 88, 12, 0); }
    100% { box-shadow: 0 0 0 0 rgba(234, 88, 12, 0); }
}

/* =====================================================
   Panel
   ===================================================== */

.cofis-chat-panel {
    position: fixed;
    right: 24px;
    bottom: 175px;
    width: 400px;
    max-width: calc(100vw - 32px);
    height: 620px;
    max-height: calc(100vh - 200px);
    background: var(--cofis-bg);
    border-radius: var(--cofis-radius-xl);
    box-shadow: var(--cofis-shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--cofis-text);
    border: 1px solid var(--cofis-border-soft);
    animation: cofisSlideUp 0.32s var(--cofis-ease);
    transform-origin: bottom right;
}

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

/* Site genelindeki global "svg { margin-bottom:-.4375rem; vertical-align:baseline }"
   kuralı widget ikonlarını aşağı kaydırıp ortadan kaçırıyordu — burada sıfırlıyoruz.
   Böylece tüm ikonlar dairelerin/butonların tam ortasına oturur. */
#cofis-chat-btn svg,
.cofis-chat-panel svg {
    margin: 0 !important;
    vertical-align: middle !important;
    display: block;
}

@keyframes cofisSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* =====================================================
   Header
   ===================================================== */

.cofis-chat-header {
    position: relative;
    background: var(--cofis-gradient);
    color: #FFFFFF;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
}

.cofis-chat-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(600px circle at 0% 0%, rgba(255,255,255,0.15), transparent 40%),
        radial-gradient(400px circle at 100% 100%, rgba(255,255,255,0.08), transparent 40%);
    pointer-events: none;
}

.cofis-chat-header > * {
    position: relative;
    z-index: 1;
}

.cofis-chat-header .title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cofis-chat-header .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.cofis-chat-header .avatar svg {
    width: 22px;
    height: 22px;
    stroke: #FFFFFF;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cofis-chat-header .avatar .status-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--cofis-success);
    border: 2px solid var(--cofis-primary);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
    animation: cofisStatusPulse 2s ease-out infinite;
}

@keyframes cofisStatusPulse {
    0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
    70%  { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.cofis-chat-header .text-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cofis-chat-header .name {
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.cofis-chat-header .status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 400;
}

.cofis-chat-header .status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34D399;
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
    animation: cofisStatusPulse 2s ease-out infinite;
}

.cofis-chat-header .actions {
    display: flex;
    gap: 4px;
}

.cofis-chat-header button {
    background: rgba(255, 255, 255, 0.12);
    border: 0;
    color: #FFFFFF;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s var(--cofis-ease), transform 0.15s var(--cofis-ease);
}

.cofis-chat-header button:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(1.05);
}

/* =====================================================
   Messages
   ===================================================== */

.cofis-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 18px 8px;
    background: var(--cofis-bg-soft);
    background-image:
        radial-gradient(circle at 25% 10%, rgba(245, 158, 11, 0.06) 0%, transparent 32%),
        radial-gradient(circle at 75% 80%, rgba(234, 88, 12, 0.05) 0%, transparent 32%);
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #E7CDB3 transparent;
}

.cofis-chat-messages::-webkit-scrollbar { width: 6px; }
.cofis-chat-messages::-webkit-scrollbar-track { background: transparent; }
.cofis-chat-messages::-webkit-scrollbar-thumb {
    background: #E7CDB3;
    border-radius: 3px;
}
.cofis-chat-messages::-webkit-scrollbar-thumb:hover { background: #D4A574; }

/* Mesaj wrapper'ları */
.cofis-msg-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    animation: cofisMsgIn 0.28s var(--cofis-ease);
}

.cofis-msg-row.user {
    justify-content: flex-end;
}

.cofis-msg-row.bot .cofis-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--cofis-gradient);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-end;
    box-shadow: 0 2px 6px rgba(234, 88, 12, 0.25);
}

.cofis-msg-row.bot .cofis-msg-avatar svg {
    width: 14px;
    height: 14px;
    stroke: #FFFFFF;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@keyframes cofisMsgIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cofis-msg {
    max-width: 78%;
    padding: 11px 14px;
    border-radius: var(--cofis-radius-lg);
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    letter-spacing: -0.005em;
}

.cofis-msg.bot {
    background: var(--cofis-bg);
    color: var(--cofis-text);
    border: 1px solid var(--cofis-border-soft);
    border-bottom-left-radius: 6px;
    box-shadow: var(--cofis-shadow-sm);
}

.cofis-msg.user {
    background: var(--cofis-gradient);
    color: #FFFFFF;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.25);
}

.cofis-msg a {
    color: var(--cofis-primary);
    text-decoration: underline;
    text-decoration-color: rgba(234, 88, 12, 0.4);
    text-underline-offset: 2px;
    font-weight: 500;
    transition: color 0.15s, text-decoration-color 0.15s;
}

.cofis-msg a:hover {
    color: var(--cofis-primary-hover);
    text-decoration-color: var(--cofis-primary-hover);
}

.cofis-msg.user a {
    color: #FFFFFF;
    text-decoration-color: rgba(255, 255, 255, 0.6);
}

.cofis-msg.user a:hover {
    text-decoration-color: #FFFFFF;
}

.cofis-msg strong {
    font-weight: 600;
    letter-spacing: -0.01em;
}

.cofis-msg ul,
.cofis-msg ol {
    padding-left: 18px;
    margin: 6px 0;
}

.cofis-msg li {
    margin: 3px 0;
}

.cofis-msg p {
    margin: 0 0 6px;
}

.cofis-msg p:last-child {
    margin: 0;
}

/* =====================================================
   Lead Form (Chat içi iletişim formu)
   ===================================================== */

.cofis-lead-form {
    background: linear-gradient(135deg, #FFFCF7 0%, #FFF7ED 100%);
    border: 1px solid var(--cofis-border-soft);
    border-radius: var(--cofis-radius-md);
    padding: 12px;
    margin: 4px 0 12px 36px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: cofisMsgIn 0.3s var(--cofis-ease);
    box-shadow: var(--cofis-shadow-sm);
}

.cofis-lead-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--cofis-text);
    letter-spacing: -0.01em;
    margin-bottom: 2px;
}

.cofis-lead-form input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--cofis-border);
    border-radius: 10px;
    background: #FFFFFF;
    font-size: 13px;
    font-family: inherit;
    color: var(--cofis-text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.cofis-lead-form input::placeholder { color: var(--cofis-text-subtle); }

.cofis-lead-form input:focus {
    border-color: var(--cofis-primary);
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.1);
}

.cofis-lead-form button {
    background: var(--cofis-gradient);
    color: #FFFFFF;
    border: 0;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.25);
}

.cofis-lead-form button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(234, 88, 12, 0.35);
}

.cofis-lead-form button:disabled { opacity: 0.6; cursor: not-allowed; }

.cofis-lead-status {
    font-size: 12px;
    color: var(--cofis-text-muted);
    text-align: center;
}

.cofis-lead-status.error {
    color: #DC2626;
    background: #FEF2F2;
    padding: 6px 10px;
    border-radius: 8px;
}

.cofis-lead-success {
    font-size: 13px;
    color: #047857;
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    font-weight: 500;
}

@media (max-width: 575px) {
    .cofis-lead-form { margin-left: 0; }
}

/* =====================================================
   Product Cards
   ===================================================== */

.cofis-products {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 4px 0 12px 36px; /* avatar boşluğu kadar offset */
}

.cofis-product-card {
    display: flex;
    gap: 12px;
    background: var(--cofis-bg);
    border: 1px solid var(--cofis-border-soft);
    border-radius: var(--cofis-radius-md);
    padding: 10px;
    text-decoration: none;
    color: var(--cofis-text);
    transition: all 0.2s var(--cofis-ease);
    position: relative;
    overflow: hidden;
}

.cofis-product-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--cofis-gradient);
    opacity: 0;
    transition: opacity 0.2s var(--cofis-ease);
}

.cofis-product-card:hover {
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: var(--cofis-shadow-md);
    color: var(--cofis-text);
    text-decoration: none;
}

.cofis-product-card:hover::before {
    opacity: 1;
}

.cofis-product-card img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--cofis-radius-sm);
    background: var(--cofis-bg-soft);
    flex-shrink: 0;
}

.cofis-product-card .info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    flex: 1;
}

.cofis-product-card .name {
    font-weight: 600;
    font-size: 13px;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--cofis-text);
}

.cofis-product-card .price {
    font-size: 13px;
    font-weight: 600;
    background: var(--cofis-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-top: 3px;
}

/* =====================================================
   Typing Indicator
   ===================================================== */

.cofis-msg-row.typing-row {
    align-items: flex-end;
}

.cofis-typing {
    display: inline-flex;
    gap: 4px;
    padding: 12px 14px;
    background: var(--cofis-bg);
    border: 1px solid var(--cofis-border-soft);
    border-radius: var(--cofis-radius-lg);
    border-bottom-left-radius: 6px;
    box-shadow: var(--cofis-shadow-sm);
}

.cofis-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--cofis-primary);
    opacity: 0.4;
    animation: cofisDot 1.2s infinite ease-in-out;
}

.cofis-typing span:nth-child(2) { animation-delay: 0.15s; }
.cofis-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes cofisDot {
    0%, 80%, 100% { transform: scale(0.65); opacity: 0.35; }
    40%           { transform: scale(1);    opacity: 1; }
}

/* =====================================================
   Input Form
   ===================================================== */

.cofis-chat-form {
    display: flex;
    align-items: flex-end;   /* textarea büyüyünce gönder butonu altta kalsın */
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid var(--cofis-border-soft);
    background: linear-gradient(180deg, var(--cofis-bg) 0%, var(--cofis-bg-soft) 100%);
    position: relative;
}

/* Çok satırlı, otomatik genişleyen yazı alanı */
.cofis-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--cofis-bg-soft);
    border: 1.5px solid var(--cofis-border);
    border-radius: 22px;
    padding: 2px 6px 2px 4px;
    transition: border-color 0.15s var(--cofis-ease), background 0.15s var(--cofis-ease), box-shadow 0.18s var(--cofis-ease);
}

.cofis-input-wrap:focus-within {
    border-color: var(--cofis-primary);
    background: var(--cofis-bg);
    box-shadow: 0 0 0 4px rgba(234, 88, 12, 0.13);
}

.cofis-chat-form textarea {
    flex: 1;
    box-sizing: border-box;
    border: 0;
    outline: none;
    resize: none;
    background: transparent;
    color: var(--cofis-text);
    font-size: 14px;
    font-family: inherit;
    line-height: 1.45;
    padding: 9px 12px;
    max-height: 120px;
    overflow-y: hidden;
    height: 40px;            /* tek satır başlangıç */
}

.cofis-chat-form textarea::placeholder {
    color: var(--cofis-text-subtle);
}

/* İnce kaydırma (5 satırı geçince) */
.cofis-chat-form textarea::-webkit-scrollbar { width: 5px; }
.cofis-chat-form textarea::-webkit-scrollbar-thumb { background: #E7CDB3; border-radius: 4px; }

.cofis-chat-form button {
    background: var(--cofis-gradient);
    color: #FFFFFF;
    border: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(234, 88, 12, 0.38);
    transition: transform 0.18s var(--cofis-ease), box-shadow 0.18s var(--cofis-ease), filter 0.15s var(--cofis-ease);
}

.cofis-chat-form button:hover {
    transform: translateY(-1px) scale(1.07);
    box-shadow: 0 8px 22px rgba(234, 88, 12, 0.5);
    filter: brightness(1.05);
}

.cofis-chat-form button:active {
    transform: scale(0.96);
}

.cofis-chat-form button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.cofis-chat-form button svg {
    width: 19px;
    height: 19px;
    fill: #FFFFFF;
    transform: translateX(1px);
}

/* =====================================================
   Hızlı Yanıt Çipleri (Quick Replies)
   ===================================================== */

.cofis-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 6px 42px;   /* bot avatar genişliği kadar girinti */
    animation: cofisMsgIn 0.4s var(--cofis-ease) both;
}

.cofis-quick-chip {
    background: var(--cofis-bg);
    border: 1.5px solid var(--cofis-border);
    color: var(--cofis-primary);
    font-size: 12.5px;
    font-weight: 600;
    font-family: inherit;
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: var(--cofis-shadow-sm);
    transition: all 0.16s var(--cofis-ease);
}

.cofis-quick-chip:hover {
    background: var(--cofis-gradient);
    border-color: transparent;
    color: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(234, 88, 12, 0.32);
}

.cofis-quick-chip:active { transform: translateY(0) scale(0.97); }

/* =====================================================
   Footer Note
   ===================================================== */

.cofis-chat-footer-note {
    font-size: 11px;
    text-align: center;
    color: var(--cofis-text-subtle);
    padding: 6px 12px 10px;
    background: var(--cofis-bg);
    letter-spacing: -0.005em;
}

.cofis-chat-footer-note::before {
    content: '✨';
    margin-right: 4px;
    filter: saturate(0.7);
}

/* =====================================================
   Mobile Responsive
   ===================================================== */

@media (max-width: 575px) {
    #cofis-chat-btn {
        right: 16px;
        bottom: 88px;
        width: 54px;
        height: 54px;
    }

    #cofis-chat-btn svg {
        width: 26px;
        height: 26px;
    }

    .cofis-chat-panel {
        right: 12px;
        left: 12px;
        bottom: 80px;
        width: auto;
        max-width: none;
        height: calc(100vh - 100px);
        border-radius: var(--cofis-radius-lg);
    }

    .cofis-chat-header {
        padding: 14px 16px;
    }

    .cofis-chat-header .avatar {
        width: 36px;
        height: 36px;
    }

    .cofis-products {
        margin-left: 0;
    }

    .cofis-msg {
        max-width: 85%;
    }
}

/* Çok küçük ekranlar */
@media (max-width: 380px) {
    .cofis-chat-panel {
        right: 8px;
        left: 8px;
    }
}
