/* ============================================================
   MATsApp GLOBAL STYLES (Tailwind Replacement)
   ============================================================ */

/* Temel Sıfırlama ve Fontlar */
body {
    background-color: #f3f4f6;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    color: #1f2937;
}

.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1 1 0%; }
.shrink-0 { flex-shrink: 0; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.w-full { width: 100%; }
.h-screen { height: 100vh; }
.max-w-xl { max-width: 36rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* Margins & Paddings */
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }

/* Kartlar ve Konteynerlar */
.bg-white { background-color: #ffffff; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-blue-50 { background-color: #eff6ff; }
.rounded-lg { border-radius: 0.5rem; }
.rounded { border-radius: 0.25rem; }
.shadow-md { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); }
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.border { border: 1px solid #e5e7eb; }
.border-b-2 { border-bottom-width: 2px; }
.border-t-4 { border-top-width: 4px; }
.border-dashed { border-style: dashed; }
.border-gray-300 { border-color: #d1d5db; }
.border-blue-600 { border-color: #2563eb; }
.border-orange-500 { border-color: #f97316; }
.border-orange-200 { border-color: #fed7aa; }

/* Metin Stilleri */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-xl { font-size: 1.25rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: 0.05em; }
.leading-tight { line-height: 1.25; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-800 { color: #1f2937; }
.text-blue-600 { color: #2563eb; }
.text-blue-700 { color: #1d4ed8; }
.text-orange-700 { color: #c2410c; }
.text-green-600 { color: #16a34a; }
.text-red-600 { color: #dc2626; }
.underline { text-decoration: underline; }

/* ============================================================
   ÖZEL BİLEŞENLER
   ============================================================ */

/* Login Logo */
.logo-container { display: flex; justify-content: center; margin-top: 15px; margin-bottom: -4px; }
.main-logo-img { width: 260px; height: auto; display: block; image-rendering: -webkit-optimize-contrast; }

/* Chat Area */
.chat-area { height: calc(100vh - 180px); overflow-y: auto; }
#chat-box p { white-space: pre-wrap !important; word-break: break-word; }

/* Inputs & Buttons */
input[type="email"], input[type="password"], input[type="text"], textarea, select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    box-sizing: border-box;
}

.login-btn {
    flex: 1; max-width: 170px; padding: 12px 0; background-color: #28a745;
    color: #fff; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; transition: 0.2s;
}
.login-btn:hover { background-color: #218838; }

/* Admin File Input Style */
input[type="file"]::file-selector-button {
    margin-right: 1rem; padding: 0.5rem 1rem; border-radius: 9999px; border: 0;
    font-size: 0.875rem; font-weight: 600; cursor: pointer;
}
#csv-file::file-selector-button { background-color: #eff6ff; color: #1d4ed8; }
#delete-csv-file::file-selector-button { background-color: #fff7ed; color: #c2410c; }

/* Status Box */
.h-32 { height: 8rem; }
.overflow-y-auto { overflow-y: auto; }

/* Transition & Hover */
.transition { transition: all 0.2s; }
.hover\:bg-blue-50:hover { background-color: #eff6ff; }
.hover\:bg-green-700:hover { background-color: #15803d; }
.hover\:bg-orange-700:hover { background-color: #c2410c; }


/* ================== MESAJ KARTLARI (DUYURULAR) ================== */

.message-card {
    background-color: #ffffff;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid #2563eb; /* Mavi yan şerit */
    margin-bottom: 12px;
}

.message-text {
    color: #1f2937;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
}

/* ================== ANKET TASARIMI ================== */

.poll-container {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.poll-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.poll-option-btn {
    flex: 1;
    text-align: left;
    padding: 8px 12px;
    font-size: 12px;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.poll-option-btn:hover:not(:disabled) {
    background-color: #eff6ff;
    border-color: #3b82f6;
}

.poll-option-btn.voted {
    background-color: #f3f4f6;
    color: #9ca3af;
    cursor: default;
}

.poll-option-view {
    flex: 1;
    font-size: 12px;
    padding: 8px 12px;
    background-color: #f9fafb;
    border: 1px solid #f3f4f6;
    color: #6b7280;
    border-radius: 6px;
}

.admin-label {
    font-size: 10px;
    font-style: italic;
    margin-left: 4px;
}

.vote-count {
    font-size: 10px;
    font-weight: 700;
    color: #2563eb;
    min-width: 40px;
    text-align: right;
}

/* ================== FOOTER (GÖNDEREN & ZAMAN) ================== */

.message-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 4px;
    border-top: 1px solid #f9fafb;
}

.sender-name {
    font-size: 10px;
    font-weight: 700;
    color: #2563eb;
}

.footer-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.viewer-count {
    font-size: 10px;
    font-weight: 700;
    color: #2563eb;
}

.message-time {
    font-size: 9px;
    color: #6b7280;
    font-weight: 600;
}

/* ================== DOSYA & SİLME ================== */

.download-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #2563eb;
    text-decoration: underline;
    background: none;
    border: none;
    cursor: pointer;
}

.delete-btn {
    color: #ef4444;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    transition: color 0.2s;
}

.delete-btn:hover {
    color: #b91c1c;
}

.file-preview {
    margin-top: 8px;
}

/* Utility: Tailwind'in yokluğunu doldurmak için */
.hidden { display: none !important; }



.btn-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    width: 100%;
    margin-bottom: 10px;
}

.login-btn {
    flex: 1; /* Genişliği eşitler */
    padding: 12px 0;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: white;
    transition: background-color 0.2s;
}

/* Giriş Yap Butonu (Yeşil) */
button[onclick="handleLogin()"] {
    background-color: #28a745;
}

/* Şifremi Unuttum Butonu (Gri) */
#forgotPasswordBtn {
    background-color: #6c757d;
}


header {
    background-color: white;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    /* 2) YATAY MAVİ ÇİZGİ */
    border-bottom: 2px solid #2563eb; 
}

.header-logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 3) DİKEY GRİ ÇİZGİ */
.header-divider {
    border-left: 1px solid #d1d5db;
    padding-left: 12px;
    height: 32px; /* Çizginin boyu */
    display: flex;
    align-items: center;
}

/* Önce resmin içinde bulunduğu kutuyu sınırlayalım */
.file-preview {
    width: 100%;
    max-width: 100%;
    overflow: hidden; /* Dışarı taşan her şeyi keser */
    display: block;
}

/* Şimdi resmi bu kutuya hapsedelim */
.base64-preview {
    /* Genişlik ayarı */
    width: 100% !important;      /* Kutunun genişliğine tam yayıl */
    max-width: 260px !important;  /* Ama asla 260px'den büyük olma (S21 gibi geniş ekranlar için) */
    
    /* Yükseklik ve Oran */
    height: auto !important;     
    aspect-ratio: auto;           /* Görüntü oranını bozma */
    
    /* Yerleşim */
    display: block;
    object-fit: contain;          /* Resmin bozulmadan kutuya sığmasını sağlar */
    border-radius: 8px;
    margin-top: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Mobilde ekran çok darsa (eski telefonlar) genişliği biraz daha kısabiliriz */
@media (max-width: 480px) {
    .base64-preview {
        max-width: 100% !important; /* Küçük ekranlarda ekranın tamamını kullanabilir */
    }
}

/* Mesaj kartına bu satırı ekleyin veya güncelleyin */
.message-card {
    background-color: #ffffff;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid #2563eb;
    margin-bottom: 12px;
    overflow: hidden; /* 👈 İçindeki resmin taşmasını engeller */
    word-wrap: break-word; /* Metinlerin taşmasını engeller */
}

/* S21 ve tüm cihazlar için resmi kesin boyutlandırma */
.base64-preview {
    display: block;
    width: auto !important;
    max-width: 100% !important; /* Kartın dışına asla çıkamaz */
    max-height: 250px !important; /* Dikeyde devleşmesini önler */
    height: auto !important;
    border-radius: 6px;
    margin-top: 10px;
    object-fit: contain; /* Oranı koruyarak sığdırır */
}

/* Giriş ekranındaki inputlar için */
#auth-screen input[type="email"],
#auth-screen input[type="password"] {
    width: 100%;           /* Kutuyu tam kapla */
    box-sizing: border-box; /* Padding dahil genişlik hesapla */
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

/* Giriş kartının çok yayılmasını önleyelim */
#auth-screen .bg-white {
    max-width: 350px; /* Kartın ekranı kaplamasını önler */
    width: 90%;       /* Mobilde kenarlardan boşluk bırakır */
}


/* Giriş ekranındaki başlık metni için */
#auth-screen h2 {
    text-align: center;      /* Metni ortalar */
    font-weight: bold;       /* Metni kalın yapar */
    margin-bottom: 20px;     /* Altındaki kutuyla arasına boşluk bırakır */
    color: #1f2937;          /* Metin rengini belirler (koyu gri/siyah) */
    font-size: 1.2rem;       /* Yazı boyutunu hafif büyütür */
}


#auth-screen {
    display: flex;
    justify-content: center; /* Yatayda ortalar */
    align-items: center;     /* Dikeyde ortalar */
    min-height: 100vh;       /* Tüm ekran yüksekliğini kullanır */
    background-color: #f3f4f6; /* Arka plan rengi */
}

/* Giriş formunun içindeki tüm öğeleri ortalamak için */
.auth-container {
    width: 90%;
    max-width: 350px;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center; /* İçindeki buton ve yazıların merkezlenmesine yardımcı olur */
}


.blm-giris {
    display: block;
    text-align: center;
    width: 100%;
    margin-top: 25px; 
    margin-bottom: -10px; 
}

.blm-giris h2 {
    display: inline-block;
    font-weight: bold;
    font-size: 1.25rem;
    color: #1a202c;
    margin: 0;
    padding: 0;
}

/* Email kutusunun üstündeki boşluğu iyice daraltalım */
#email {
    margin-top: 0 !important; /* Metne olan yakınlığı buradan milimetrik ayarlayabilirsiniz */
    width: 100%;
    box-sizing: border-box;
}


/* Hazır Mesaj Seçim Menüsü (Select) */
#template-select {
    background-color: #fef08a; /* Sarı arka plan (Tailwind yellow-200 karşılığı) */
    color: #854d0e;            /* Koyu kahve/sarı yazı rengi (okunabilirlik için) */
    border: 1px solid #eab308; /* Altın/Sarı kenarlık */
    padding: 8px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-bottom: 10px;
    transition: all 0.2s;
}

#template-select:focus {
    outline: none;
    background-color: #fde047; /* Odaklanınca biraz daha parlak sarı */
    border-color: #ca8a04;
    box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.2);
}

/* Seçeneklerin (Option) içindeki yazıların rengini korumak için */
#template-select option {
    background-color: #ffffff; /* Açılan listedeki seçenekler beyaz kalsın (daha temiz durur) */
    color: #1f2937;
}

