/* core_app/static/css/custom-widgets.css */
/* ------------------------------------------------------------------
 * Chat Widget
 * ------------------------------------------------------------------ */
 .chat-bubble {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background-color: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: var(--shadow-soft, 0 12px 36px rgba(15, 23, 42, 0.03));
    z-index: 1050;
    transition: transform 0.2s;
  }
  .chat-bubble:hover {
    transform: scale(1.1);
  }
  .chat-widget {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 350px;
    max-width: 90vw;
    height: 500px;
    max-height: 70vh;
    background-color: #F8FAFC;
    border-radius: 15px;
    box-shadow: var(--shadow-soft, 0 12px 36px rgba(15, 23, 42, 0.03));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1049;
    transform: scale(0);
    transform-origin: bottom right;
    transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  }
  .chat-widget.open {
    transform: scale(1);
  }
  .chat-header {
    background-color: var(--primary);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
  }
  .chat-header h5 {
    margin: 0;
  }
  .chat-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
  }
  .chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .chat-message {
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 85%;
    word-wrap: break-word;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  .user-message {
    background-color: var(--accent);
    color: #FFFFFF;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
  }
  .model-message {
    background-color: #E9ECEF;
    color: #23313b;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid #DEE2E6;
  }
  .typing-indicator {
    align-self: flex-start;
    display: flex;
    gap: 5px;
    padding: 8px 12px;
  }
  .typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: #CCC;
    border-radius: 50%;
    animation: typing 1s infinite;
  }
  .typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
  .typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
  @keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
  }
  .feedback-buttons {
    margin-top: 10px;
    border-top: 1px solid #D1D9E2;
    padding-top: 8px;
    display: flex;
    gap: 8px;
  }
  .feedback-buttons button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
    min-width: 44px;
    min-height: 44px;
  }
  .feedback-buttons button:hover,
  .feedback-buttons button:active {
    opacity: 1;
    transform: scale(1.2);
  }
  .feedback-buttons button.selected {
    opacity: 1;
    transform: scale(1.2);
    pointer-events: none;
  }
  .feedback-buttons button:disabled {
    opacity: 0.3;
    cursor: default;
    transform: none;
    pointer-events: none;
  }
  .chat-input-form {
    display: flex;
    padding: 10px;
    border-top: 1px solid #DEE2E6;
    background-color: #FFFFFF;
    flex-shrink: 0;
  }
  .chat-input-form input {
    flex-grow: 1;
    border: 1px solid #CCC;
    border-radius: 20px;
    padding: 8px 15px;
    margin-right: 10px;
  }
  .chat-input-form button {
    border-radius: 50%;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    background-color: var(--accent);
    border-color: var(--accent);
  }
  .model-message,
  .user-message {
    max-width: 100%;
  }
  
  /* === YENİ: Hukuki Metin Modal Stili === */
  .legal-modal-content {
    font-size: 0.95rem;
    line-height: 1.6;
  }
  .legal-modal-content h1,
  .legal-modal-content h2,
  .legal-modal-content h3 {
    font-size: 1.75rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
  }
  .legal-modal-content p {
    margin-bottom: 1rem;
  }
  .legal-modal-content ul,
  .legal-modal-content ol {
    padding-left: 2rem;
    margin-bottom: 1rem;
  }
  /* === Hukuki modal SONU === */
  
  /* ==================================================================
   * Rating Yıldızları
   * ================================================================== */
  .rating-stars {
    display: inline-flex;
    flex-direction: row-reverse;
    justify-content: start;
  }
  .rating-stars input[type="radio"] {
    display: none;
  }
  .rating-stars label {
    font-size: 1.5rem;
    color: #ddd;
    cursor: pointer;
    padding: 0 0.1em;
    transition: color 0.2s;
  }
  .rating-stars:not(:hover) input[type="radio"]:checked ~ label,
  .rating-stars:hover input[type="radio"] ~ label:hover,
  .rating-stars:hover input[type="radio"] ~ label:hover ~ label {
    color: #f5c518;
  }
  
  /* Statik puan göstergesi */
  .static-rating .fas,
  .static-rating .far {
    font-size: 1.1rem;
  }
  .static-rating .star-filled {
    color: #f5c518;
  }
  .static-rating .star-empty {
    color: #ddd;
  }
  
  /* ==================================================================
   * INLINE FORMSET "SİL" BUTONU STİLLERİ
   * ================================================================== */
  .formset-row-container {
    position: relative;
    padding: 1.25rem;
    padding-top: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: opacity 0.3s ease;
  }
  
  /* "Sil" (Çöp Kutusu) butonu */
  .btn-delete-formset-row {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    padding: 0;
    color: #dc3545;
    border-color: #dc3545;
    background-color: transparent;
  }
  .btn-delete-formset-row:hover {
    background-color: #dc3545;
    color: white;
  }
  
  /* Silinmek üzere işaretlenen satırı (JS ile) soluklaştır */
  .formset-row-deleted {
    opacity: 0.5;
    background-color: #f8f9fa;
    border-style: dashed;
  }
  .formset-row-deleted input,
  .formset-row-deleted select,
  .formset-row-deleted textarea {
    pointer-events: none;
  }
  
  .formset-row.htmx-swapping {
    opacity: 0;
    transition: opacity 0.5s ease-out;
  }
  
  /* ==================================================================
   * PAYLAŞIM ŞEMASI GÖRSELİ (schema)
   * ================================================================== */
  .schema-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    overflow: hidden;
  }
  .schema-floor {
    display: flex;
    flex-direction: row;
    border-bottom: 1px solid #dee2e6;
  }
  .schema-floor:last-child {
    border-bottom: 0;
  }
  .floor-label {
    flex: 0 0 150px;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
  }
  .units-container {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0;
  }
  .unit-cell {
    padding: 0.75rem;
    border-right: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    background-color: #fff;
    font-size: 0.85rem;
  }
  .units-container .unit-cell:last-child {
    border-right: 0;
  }
  .unit-cell strong {
    display: block;
    color: #000;
    font-size: 0.9rem;
  }
  .unit-cell .text-muted {
    font-size: 0.8rem;
  }
  .unit-owners {
    margin-top: 5px;
    font-size: 0.75rem;
    border-top: 1px dashed #ccc;
    padding-top: 5px;
  }
  .unit-owners span {
    display: block;
  }
  
  /* ==================================================================
   * ROADMAP / ZAMAN ÇİZELGESİ
   * ================================================================== */
  .roadmap-timeline-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
  }
  .roadmap-timeline {
    display: flex;
    padding: 1.5rem 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f5f5f5;
  }
  .roadmap-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    flex-grow: 1;
    flex-basis: 0;
    min-width: 120px;
    padding: 0 5px;
    flex-shrink: 0;
  }
  .step-icon-wrapper {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e0e0e0;
    background-color: #f8f9fa;
    color: #5f6b7a;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
  }
  .step-icon-wrapper i {
    font-size: 1.5rem;
  }
  .step-label {
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.75rem;
    color: #6c757d;
    line-height: 1.3;
  }
  .step-date {
    font-size: 0.75rem;
    color: #5f6b7a;
    font-weight: 600;
    white-space: nowrap;
    margin-top: auto;
    padding-top: 8px;
  }
  
  /* Çizgi */
  .roadmap-step::after {
    content: '';
    position: absolute;
    top: 25px;
    left: 50%;
    width: 100%;
    height: 2px;
    background-color: #e0e0e0;
    z-index: 1;
  }
  .roadmap-step:first-child::after {
    left: 50%;
    width: 50%;
  }
  .roadmap-step:last-child::after {
    width: 0;
  }
  
  /* Tamamlanmış (Completed) Adım */
  .roadmap-step.completed .step-icon-wrapper {
    border-color: #198754;
    background-color: #198754;
    color: #fff;
  }
  .roadmap-step.completed .step-label {
    color: #198754;
    font-weight: 600;
  }
  .roadmap-step.completed::after {
    background-color: #198754;
  }
  
  /* Aktif (Active) Adım */
  .roadmap-step.active .step-icon-wrapper {
    border-color: var(--accent, #8b5cf6);
    background-color: var(--accent, #8b5cf6);
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
  }
  .roadmap-step.active .step-label {
    color: var(--accent, #8b5cf6);
    font-weight: 700;
  }
  .roadmap-step.active .step-date {
    color: var(--accent, #8b5cf6);
  }
  
  /* Aktif adım iconu tıklanabilir */
  .roadmap-step.active a.step-icon-wrapper {
    cursor: pointer;
  }
  .roadmap-step.active a.step-icon-wrapper:hover {
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.7);
  }
  
  /* Zaman Planı Dropdown */
  .roadmap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.5rem;
  }
  .roadmap-header-title {
    flex-shrink: 0;
  }
  .roadmap-header-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 260px;
  }
  
  /* ============================
   GLOBAL TARİH / TAKVİM STİLİ
   (Flatpickr)
   ============================ */

/* Input görünümü */
input.date-picker,
input.js-date-picker,
input.datepicker {
    background-color: #ffffff;
    cursor: pointer;
}

/* Genel takvim kutusu */
.flatpickr-calendar {
    border: 1px solid #e2e8f0 !important;
    box-shadow: var(--shadow-soft, 0 12px 36px rgba(15, 23, 42, 0.03)) !important;
    border-radius: 12px !important;
    font-family: inherit !important;
}

/* Ay / yıl barı biraz sade */
.flatpickr-months {
    border-bottom: 1px solid #e5e7eb;
}
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
    border-radius: var(--radius-2026-btn, 14px);
    background-color: #f3f4f6;
    border: none;
    padding: 2px 8px;
    font-weight: 600;
}

/* Gün hücreleri – aralarda çizgi yok, hafif boşluk + yuvarlak */
.flatpickr-day {
    border-radius: 999px !important;
    border: 1px solid transparent !important;
    margin: 3px 2px;
    font-weight: 500;
    color: #23313b;
}

/* Hover */
.flatpickr-day:hover {
    background-color: #f3f4f6 !important;
}

/* Bugün – gri yuvarlak çember */
.flatpickr-day.today {
    border-color: #9ca3af !important;
    background-color: #f9fafb !important;
    color: #23313b !important;
}

/* Seçili gün – dolu, renkli yuvarlak */
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background-color: #0ea5e9 !important;   /* mavi */
    border-color: #0ea5e9 !important;
    color: #ffffff !important;
}

/* Hafta sonları hafif gri */
.flatpickr-weekdays {
    font-weight: 500;
}
.flatpickr-weekday {
    color: #6b7280;
}
.flatpickr-calendar .flatpickr-days .dayContainer .flatpickr-day:nth-child(7n),
.flatpickr-calendar .flatpickr-days .dayContainer .flatpickr-day:nth-child(7n-1) {
    color: #9ca3af;
}

/* Devre dışı günler (disabled) */
.flatpickr-day.disabled,
.flatpickr-day.disabled:hover {
    color: #d1d5db !important;
    background-color: transparent !important;
    border-color: transparent !important;
}

 /* =========================================================
   LEGAL – GENEL TİPOGRAFİ
   (consent_page, public page, modal hepsi için ortak)
   ========================================================= */

/* Uzun hukuki metnin ana gövdesi */
.legal-content-wrapper,
.legal-consent-text-box,
.pm-legal-consent-copy {
    font-size: 0.95rem;         /* Genel metni çok büyütmeden okunur tut */
    line-height: 1.7;           /* Satırlar arasını aç */
    color: var(--text-secondary);
    white-space: pre-line;      /* DÜZ METİN satır sonlarını koru (şu anki sıkışıklığı çözen kritik ayar) */
}

/* En üst başlıklar (H1) */
.legal-content-wrapper h1,
.legal-consent-text-box h1,
.pm-legal-consent-copy h1 {
    font-size: 1.3rem !important;
    font-weight: 700;
    line-height: 1.35;
    margin-top: 0;
    margin-bottom: 0.75rem;
}

/* Bölüm başlıkları (H2) */
.legal-content-wrapper h2,
.legal-consent-text-box h2,
.pm-legal-consent-copy h2 {
    font-size: 1.1rem !important;
    font-weight: 700;
    line-height: 1.4;
    margin-top: 1.5rem;
    margin-bottom: 0.6rem;
}

/* Alt başlıklar (H3) */
.legal-content-wrapper h3,
.legal-consent-text-box h3,
.pm-legal-consent-copy h3 {
    font-size: 1rem !important;
    font-weight: 700;
    line-height: 1.45;
    margin-top: 1.1rem;
    margin-bottom: 0.45rem;
}

/* Daha küçük alt başlıklar (H4–H5) */
.legal-content-wrapper h4,
.legal-consent-text-box h4,
.pm-legal-consent-copy h4,
.legal-content-wrapper h5,
.legal-consent-text-box h5,
.pm-legal-consent-copy h5 {
    font-size: 0.96rem !important;
    font-weight: 700;
    line-height: 1.45;
    margin-top: 1rem;
    margin-bottom: 0.4rem;
}

/* Paragraflar ve listeler */
.legal-content-wrapper p,
.legal-consent-text-box p,
.pm-legal-consent-copy p,
.legal-content-wrapper ul,
.legal-consent-text-box ul,
.pm-legal-consent-copy ul,
.legal-content-wrapper ol,
.legal-consent-text-box ol,
.pm-legal-consent-copy ol,
.legal-content-wrapper li,
.legal-consent-text-box li,
.pm-legal-consent-copy li {
    margin-bottom: 0.85rem;
    font-size: 0.95rem !important;
    line-height: 1.75;
}

/* Liste içi hizalama */
.legal-content-wrapper ul,
.legal-consent-text-box ul,
.pm-legal-consent-copy ul,
.legal-content-wrapper ol,
.legal-consent-text-box ol,
.pm-legal-consent-copy ol {
    padding-left: 1.6rem;
}

/* Kalın vurguyu biraz yumuşat */
.legal-content-wrapper strong,
.legal-consent-text-box strong,
.pm-legal-consent-copy strong,
.legal-content-wrapper b,
.legal-consent-text-box b,
.pm-legal-consent-copy b {
    font-weight: 600;
}

.legal-content-wrapper h1 *,
.legal-consent-text-box h1 *,
.pm-legal-consent-copy h1 *,
.legal-content-wrapper h2 *,
.legal-consent-text-box h2 *,
.pm-legal-consent-copy h2 *,
.legal-content-wrapper h3 *,
.legal-consent-text-box h3 *,
.pm-legal-consent-copy h3 *,
.legal-content-wrapper h4 *,
.legal-consent-text-box h4 *,
.pm-legal-consent-copy h4 *,
.legal-content-wrapper h5 *,
.legal-consent-text-box h5 *,
.pm-legal-consent-copy h5 * {
    font-size: inherit !important;
    line-height: inherit;
}

.legal-content-wrapper p *,
.legal-consent-text-box p *,
.pm-legal-consent-copy p *,
.legal-content-wrapper li *,
.legal-consent-text-box li *,
.pm-legal-consent-copy li * {
    font-size: inherit !important;
    line-height: inherit;
}

/* =========================================================
   CONSENT PAGE (Onay Gerekiyor Ekranı)
   ========================================================= */

.consent-card-body {
    font-size: 0.9rem;
}

.consent-card-body .lead {
    font-size: 1rem;
}

.consent-card-body h5 {
    font-size: 1.1rem;
}

/* Onay sayfasındaki kaydırmalı kutu */
.legal-consent-text-box {
    background-color: #f9fafb;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    max-height: 320px;
    overflow-y: auto;
    padding: 1rem 1.25rem;
}

/* Onay kutucuğu yazısı */
.consent-card-body .form-check-label {
    font-size: 0.9rem;
}

/* =========================================================
   LEGAL MODAL (Footer’daki Kullanım, Gizlilik, Çerez vb.)
   ========================================================= */

#legalModal .modal-dialog {
    max-width: 960px;
}

#legalModal .modal-content {
    border-radius: var(--radius-2026, 20px);
}

#legalModal .modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

#legalModal .modal-body {
    padding: 1rem 1.5rem;
    background-color: #f9fafb;
}

/* Modal içindeki asıl metin kutusu */
#legalModal .legal-content-wrapper {
    max-height: 60vh;                 /* Ekranın %60'ı kadar, sonrası scroll */
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    background-color: #ffffff;
    border-radius: var(--radius-2026, 20px);
    border: 1px solid var(--border-color);
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.02);
}

/* ==================================================================
 * MOBİL UYUMLULUK — WIDGET'LAR
 * ================================================================== */
@media (max-width: 767.98px) {
    .chat-bubble {
        bottom: 16px;
        right: 16px;
        width: 52px;
        height: 52px;
        font-size: 24px;
    }

    .chat-widget {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: calc(var(--visual-viewport-height, 75dvh) - var(--visual-viewport-offset-top, 0px));
        max-height: calc(var(--visual-viewport-height, 75dvh) - var(--visual-viewport-offset-top, 0px));
        border-radius: 16px 16px 0 0;
        transform-origin: bottom center;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .chat-messages {
        -webkit-overflow-scrolling: touch;
    }

    .chat-input-form input {
        font-size: 16px;  /* iOS zoom engelleme */
    }

    .chat-input-form button {
        min-width: 44px;
        min-height: 44px;
    }

    .roadmap-step {
        min-width: 100px;
    }

    .roadmap-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .roadmap-header-form {
        width: 100%;
        min-width: auto;
    }

    .legal-modal-content h1,
    .legal-modal-content h2,
    .legal-modal-content h3 {
        font-size: 1.25rem;
    }
}

@media (max-width: 575.98px) {
    .chat-widget {
        height: calc(var(--visual-viewport-height, 85dvh) - var(--visual-viewport-offset-top, 0px));
        max-height: calc(var(--visual-viewport-height, 85dvh) - var(--visual-viewport-offset-top, 0px));
    }

    .roadmap-step {
        min-width: 85px;
    }

    .step-icon-wrapper {
        width: 40px;
        height: 40px;
    }

    .step-icon-wrapper i {
        font-size: 1.2rem;
    }

    .step-label {
        font-size: 0.72rem;
    }
}

html.mobile-keyboard-open .chat-widget {
    height: calc(var(--visual-viewport-height, 100dvh) - var(--visual-viewport-offset-top, 0px));
    max-height: calc(var(--visual-viewport-height, 100dvh) - var(--visual-viewport-offset-top, 0px));
}
