/**
 * Starlit-tempmail — Görünüm 2 (detaylı panel)
 *
 * Sorumluluk: Kenar çubuğu, klasör listesi, adres kartı, arama başlığı, bölünmüş
 * düzen, e-posta listesi öğeleri, boş durumlar ve okuma alanı.
 *
 * Yükleme sırası önemlidir: CSS art arda uygulandığı için bu dosyalar
 * `inc/bootstrap.php` içinde base -> simple-view -> detail-view -> components
 * -> responsive sırasıyla kuyruğa alınır. Sıra değişirse geçersiz kılmalar bozulur.
 */

.starlit-tm-wrapper {
    display: flex;
    width: 100vw;
    height: 100vh;
    background-color: var(--starlit-bg-black);
    color: var(--starlit-text-primary);
    overflow: hidden;
}

/* 1. Sidebar */
.starlit-sidebar {
    width: 270px;
    border-right: 1px solid var(--starlit-border-silver);
    background-color: var(--starlit-panel-dark);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    flex-shrink: 0;
}

.starlit-sidebar-header {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.starlit-brand {
    font-family: 'Outfit', sans-serif;
    font-size: 19px;
    font-weight: 800;
    color: var(--starlit-accent-white);
    letter-spacing: -0.4px;
}

.starlit-mailbox-manager {
    margin-bottom: 20px;
}

.section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--starlit-text-darker);
    margin-bottom: 8px;
    display: block;
}

.mailbox-selector-wrapper {
    margin-bottom: 8px;
}

.starlit-sidebar-add-btn {
    width: 100%;
    padding: 9px 12px;
    background: var(--starlit-control-bg);
    border: 1px solid var(--starlit-border-silver);
    border-radius: 8px;
    color: var(--starlit-text-primary);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.starlit-sidebar-add-btn:hover {
    background: var(--starlit-control-bg-hover);
    border-color: var(--starlit-control-border-hover);
    color: var(--starlit-text-primary);
}

.starlit-folders {
    list-style: none;
    margin: 0 0 20px 0;
    padding: 0;
}

.folder-item {
    display: flex;
    align-items: center;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--starlit-text-muted);
    cursor: pointer;
    margin-bottom: 3px;
}

.folder-item:hover {
    background-color: var(--starlit-hover-overlay);
    color: var(--starlit-text-primary);
}

.folder-item.active {
    background-color: var(--starlit-border-silver);
    color: var(--starlit-text-primary);
    font-weight: 600;
}

.folder-icon {
    margin-right: 10px;
    font-size: 15px;
}

/* Sidebar Address Card */
.starlit-address-card {
    margin-top: auto;
    background-color: var(--starlit-surface-raised);
    border: 1px solid var(--starlit-border-silver);
    border-radius: 12px;
    padding: 14px;
}

.address-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--starlit-text-darker);
    margin-bottom: 6px;
}

.address-value-container {
    background-color: var(--starlit-surface-sunken);
    border: 1px dashed var(--starlit-dashed-border);
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    cursor: pointer;
}

.address-text {
    font-size: 12px;
    font-weight: 600;
    font-family: monospace;
    color: var(--starlit-text-primary);
}

.address-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    width: 100%;
}

.starlit-card-action-btn {
    padding: 8px 4px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    font-family: inherit !important;
    border-radius: 7px !important;
    background: var(--starlit-control-bg) !important;
    border: 1px solid var(--starlit-control-border) !important;
    color: var(--starlit-control-text) !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    white-space: nowrap !important;
    user-select: none !important;
}

.starlit-card-action-btn:hover {
    background: var(--starlit-control-bg-hover) !important;
    border-color: var(--starlit-control-border-hover) !important;
    color: var(--starlit-control-text-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--starlit-shadow);
}

.starlit-card-action-btn:active {
    transform: scale(0.94) translateY(0) !important;
}

.starlit-card-action-danger {
    color: #f87171 !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    background: rgba(239, 68, 68, 0.08) !important;
}

.starlit-card-action-danger:hover {
    background: rgba(239, 68, 68, 0.25) !important;
    border-color: #ef4444 !important;
    color: var(--starlit-control-text-hover) !important;
}

.starlit-card-action-danger:active {
    transform: scale(0.94) !important;
}

/* 2. Main Content Area */
.starlit-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--starlit-bg-black);
}

.starlit-main-header {
    height: 60px;
    border-bottom: 1px solid var(--starlit-border-silver);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px) minmax(0, 1fr);
    align-items: center;
    padding: 0 20px;
    flex-shrink: 0;
}

.starlit-search-bar {
    position: relative;
    display: flex;
    align-items: center;
    background-color: var(--starlit-hover-overlay);
    border: 1px solid var(--starlit-border-silver);
    border-radius: 8px;
    padding: 0 12px;
    grid-column: 2;
    width: 100%;
    max-width: 100%;
    height: 38px;
    box-sizing: border-box;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 8px;
}

.starlit-search-bar:focus-within {
    border-color: var(--starlit-accent-silver, #38bdf8);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
    background-color: var(--starlit-panel-dark);
}

.starlit-search-bar .starlit-search-icon,
.starlit-search-bar .search-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    color: var(--starlit-text-darker);
    opacity: 0.8;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.starlit-search-bar:focus-within .starlit-search-icon,
.starlit-search-bar:focus-within .search-icon {
    color: var(--starlit-accent-silver, #38bdf8);
    opacity: 1;
}

.starlit-search-bar .starlit-input,
.starlit-search-bar #starlit-search-input {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 13px;
    font-family: inherit;
    color: var(--starlit-text-primary);
    outline: none !important;
    box-shadow: none !important;
    line-height: normal;
}

.starlit-search-bar .starlit-input::placeholder {
    color: var(--starlit-text-darker);
    opacity: 0.75;
}

.starlit-actions-toolbar {
    grid-column: 3;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 8px;
}

.starlit-topbar-btn {
    width: 38px !important;
    height: 38px !important;
    border-radius: 8px !important;
    background: var(--starlit-control-bg) !important;
    border: 1px solid var(--starlit-control-border) !important;
    color: var(--starlit-control-text) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    user-select: none !important;
}

.starlit-topbar-btn:hover {
    background: var(--starlit-control-bg-hover) !important;
    border-color: var(--starlit-control-border-hover) !important;
    color: var(--starlit-control-text-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.starlit-topbar-btn:active {
    transform: scale(0.92) !important;
}

.starlit-topbar-btn.spinning .refresh-spinner-svg,
.starlit-topbar-btn .refresh-spinner-svg.spinning,
.refresh-spinner-svg.spinning {
    animation: starlit-spin 0.75s linear infinite !important;
}

.starlit-topbar-back-btn {
    height: 38px !important;
    padding: 0 16px !important;
    border-radius: 8px !important;
    background: var(--starlit-control-bg) !important;
    border: 1px solid var(--starlit-control-border) !important;
    color: var(--starlit-control-text) !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    font-family: inherit !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    user-select: none !important;
}

.starlit-topbar-back-btn:hover {
    background: var(--starlit-control-bg-hover) !important;
    border-color: var(--starlit-control-text-hover) !important;
    color: var(--starlit-control-text-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.starlit-topbar-back-btn:active {
    transform: scale(0.95) !important;
}

@keyframes starlit-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Split Pane Layout */
.starlit-split-view {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
}

/* Left Pane: Inbox List */
.starlit-pane-list {
    width: 360px;
    border-right: 1px solid var(--starlit-border-silver);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
    background-color: var(--starlit-panel-dark);
}

/* Message Item styling */
.starlit-mail-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--starlit-border-silver);
    cursor: pointer;
    position: relative;
}

.starlit-mail-item:hover {
    background-color: var(--starlit-hover-overlay);
}

.starlit-mail-item.selected {
    background-color: var(--starlit-border-silver);
}

.starlit-mail-item.selected::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--starlit-accent-white);
}

.mail-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.mail-item-sender {
    font-size: 14px;
    font-weight: 600;
    color: var(--starlit-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70%;
}

.mail-item-date {
    font-size: 11px;
    color: var(--starlit-text-darker);
}

.mail-item-subject {
    font-size: 13px;
    font-weight: 500;
    color: var(--starlit-text-primary);
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-item-body-preview {
    font-size: 12px;
    color: var(--starlit-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.5;
}

.mail-item-badges {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    align-items: center;
}

.tag-badge {
    background-color: var(--starlit-control-bg);
    border: 1px solid var(--starlit-border-silver);
    color: var(--starlit-text-primary);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.star-icon-indicator {
    color: #facc15;
    font-size: 14px;
}

/* Empty states and loaders */
.mail-list-empty-msg, .viewer-empty-msg {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    color: var(--starlit-text-muted);
    height: 100%;
}

.empty-icon {
    font-size: 40px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.mail-loader-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    height: 100%;
    color: var(--starlit-text-muted);
}

.loader-circle {
    width: 30px;
    height: 30px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--starlit-accent-white);
    border-radius: 50%;
    animation: starlit-spin 0.8s linear infinite;
    margin-bottom: 12px;
}

/* Right Pane: Reading Viewer */
.starlit-pane-viewer {
    flex-grow: 1;
    overflow-y: auto;
    background-color: var(--starlit-bg-black);
    display: flex;
    flex-direction: column;
}

.starlit-viewer-content-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.viewer-header {
    padding: 24px;
    border-bottom: 1px solid var(--starlit-border-silver);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-shrink: 0;
}

.viewer-header-meta {
    max-width: 70%;
}

.viewer-subject-text {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 14px 0;
    color: var(--starlit-text-primary);
}

.viewer-sender-row, .viewer-recipient-row, .viewer-date-row {
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--starlit-text-muted);
}

.viewer-meta-label {
    font-weight: 600;
    color: var(--starlit-text-darker);
    display: inline-block;
    width: 50px;
}

.viewer-sender-name {
    font-weight: 600;
    color: var(--starlit-text-primary);
    margin-right: 4px;
}

.viewer-sender-email {
    font-family: monospace;
    font-size: 12px;
}

.viewer-recipient-email {
    font-family: monospace;
    font-size: 12px;
}

.viewer-actions {
    display: flex;
    gap: 8px;
}

.viewer-action-btn {
    background-color: transparent;
    border: 1px solid var(--starlit-border-silver);
    border-radius: 6px;
    padding: 6px 12px;
    color: var(--starlit-text-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.viewer-action-btn:hover {
    border-color: var(--starlit-accent-white);
    color: var(--starlit-text-primary);
    box-shadow: 0 0 8px var(--starlit-accent-glow);
}

.viewer-action-btn-danger:hover {
    border-color: var(--starlit-danger);
    background-color: var(--starlit-danger-glow);
    color: var(--starlit-text-primary);
    box-shadow: none;
}

.viewer-body {
    flex-grow: 1;
    padding: 20px;
    background-color: var(--starlit-bg-black);
    display: flex;
}

#starlit-mail-iframe {
    width: 100%;
    height: 100%;
    min-height: 480px;
    border: 1px solid var(--starlit-border-silver);
    border-radius: 8px;
    background-color: #ffffff;
}

/* ==========================================================================
 * Açık Tema Kapsamlı Düzeltmeleri (Siyahlık ve Kontrast Bugu Çözümü)
 * ========================================================================== */

/* 1. Okuma Alanı ve Gövde: Siyah kutu ve çerçeve hatasını tamamen kaldır */
body.starlit-light-theme .starlit-tm-wrapper,
body.starlit-light-theme .starlit-main,
body.starlit-light-theme .starlit-pane-viewer,
body.starlit-light-theme .viewer-body-container,
body.starlit-light-theme .viewer-body {
    background-color: #f8fafc !important;
}

body.starlit-light-theme .viewer-body {
    padding: 16px !important;
}

body.starlit-light-theme #starlit-mail-iframe {
    background-color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

body.starlit-light-theme .viewer-header {
    background-color: #ffffff !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

/* 2. Sol Kenar Çubuğu Adres Kartı (Siyah Kutu Hatası) */
body.starlit-light-theme .starlit-address-card {
    background-color: #f8fafc !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

body.starlit-light-theme .address-label {
    color: #64748b !important;
}

body.starlit-light-theme .address-value-container {
    background-color: #ffffff !important;
    border: 1px dashed rgba(0, 0, 0, 0.18) !important;
}

body.starlit-light-theme .address-text {
    color: #0f172a !important;
    font-weight: 700 !important;
}

body.starlit-light-theme .starlit-card-action-btn {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    color: #334155 !important;
}

body.starlit-light-theme .starlit-card-action-btn:hover {
    background: #f1f5f9 !important;
    border-color: rgba(0, 0, 0, 0.25) !important;
    color: #000000 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06) !important;
}

body.starlit-light-theme .starlit-card-action-danger {
    background: #fef2f2 !important;
    border-color: #fecaca !important;
    color: #dc2626 !important;
}

body.starlit-light-theme .starlit-card-action-danger:hover {
    background: #fee2e2 !important;
    border-color: #ef4444 !important;
    color: #b91c1c !important;
}

/* 3. Üst Bar Butonları (Beyaz Üstüne Beyaz Simgeler ve Metinler) */
body.starlit-light-theme .starlit-main-header {
    background-color: #ffffff !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

body.starlit-light-theme .starlit-topbar-btn {
    background: #f8fafc !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    color: #0f172a !important;
}

body.starlit-light-theme .starlit-topbar-btn svg {
    stroke: #0f172a !important;
    color: #0f172a !important;
}

body.starlit-light-theme .starlit-topbar-btn:hover {
    background: #f1f5f9 !important;
    border-color: rgba(0, 0, 0, 0.25) !important;
    color: #000000 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06) !important;
}

body.starlit-light-theme .starlit-topbar-btn:hover svg {
    stroke: #000000 !important;
    color: #000000 !important;
}

body.starlit-light-theme .starlit-topbar-back-btn {
    background: #f8fafc !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    color: #0f172a !important;
}

body.starlit-light-theme .starlit-topbar-back-btn svg {
    stroke: #0f172a !important;
    color: #0f172a !important;
}

body.starlit-light-theme .starlit-topbar-back-btn span {
    color: #0f172a !important;
}

body.starlit-light-theme .starlit-topbar-back-btn:hover {
    background: #f1f5f9 !important;
    border-color: rgba(0, 0, 0, 0.25) !important;
    color: #000000 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06) !important;
}

body.starlit-light-theme .starlit-topbar-back-btn:hover svg {
    stroke: #000000 !important;
}

body.starlit-light-theme .starlit-topbar-back-btn:hover span {
    color: #000000 !important;
}

/* 4. Arama Çubuğu */
body.starlit-light-theme .starlit-search-bar {
    background-color: #f8fafc !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
}

body.starlit-light-theme .starlit-search-bar:focus-within {
    border-color: #0284c7 !important;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
    background-color: #ffffff !important;
}

body.starlit-light-theme .starlit-search-bar .starlit-search-icon,
body.starlit-light-theme .starlit-search-bar .search-icon {
    color: #64748b !important;
}

body.starlit-light-theme .starlit-search-bar:focus-within .starlit-search-icon {
    color: #0284c7 !important;
}

body.starlit-light-theme .starlit-search-bar .starlit-input {
    color: #0f172a !important;
}

body.starlit-light-theme .starlit-search-bar .starlit-input::placeholder {
    color: #94a3b8 !important;
}

/* 5. Görüntüleyici Aksiyon Düğmeleri ("Yıldızla", "İndir", "Yazdır", "Sil") */
body.starlit-light-theme .viewer-action-btn {
    background-color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    color: #334155 !important;
}

body.starlit-light-theme .viewer-action-btn:hover {
    background-color: #f1f5f9 !important;
    border-color: rgba(0, 0, 0, 0.25) !important;
    color: #0f172a !important;
}

body.starlit-light-theme .viewer-action-btn.starred-active {
    background-color: #fefce8 !important;
    border-color: #fde047 !important;
    color: #ca8a04 !important;
}

/* 6. Kenar Çubuğu E-posta Ekle Düğmesi ve Klasörler */
body.starlit-light-theme .starlit-sidebar {
    background-color: #ffffff !important;
    border-right: 1px solid rgba(0, 0, 0, 0.08) !important;
}

body.starlit-light-theme .starlit-sidebar-add-btn {
    background: #f8fafc !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    color: #0f172a !important;
}

body.starlit-light-theme .starlit-sidebar-add-btn:hover {
    background: #f1f5f9 !important;
    border-color: rgba(0, 0, 0, 0.25) !important;
    color: #000000 !important;
}

body.starlit-light-theme .folder-item {
    color: #475569 !important;
}

body.starlit-light-theme .folder-item:hover {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}

body.starlit-light-theme .folder-item.active {
    background-color: #e2e8f0 !important;
    color: #0f172a !important;
    font-weight: 600 !important;
}

/* 7. E-posta Listesi Paneli */
body.starlit-light-theme .starlit-pane-list {
    background-color: #ffffff !important;
    border-right: 1px solid rgba(0, 0, 0, 0.08) !important;
}

body.starlit-light-theme .starlit-mail-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
}

body.starlit-light-theme .starlit-mail-item:hover {
    background-color: #f8fafc !important;
}

body.starlit-light-theme .starlit-mail-item.selected {
    background-color: #f1f5f9 !important;
}

body.starlit-light-theme .starlit-mail-item.selected::before {
    background-color: #0f172a !important;
}

body.starlit-light-theme .mail-item-sender {
    color: #0f172a !important;
}

body.starlit-light-theme .mail-item-subject {
    color: #1e293b !important;
}

body.starlit-light-theme .mail-item-body-preview {
    color: #64748b !important;
}

body.starlit-light-theme .tag-badge {
    background-color: #f1f5f9 !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: #475569 !important;
}
