:root { 
    --primary: #2563eb; 
    --primary-hover: #1d4ed8;
    --success: #16a34a; 
    --danger: #dc2626; 
    --bg-color: #f8fafc; 
    --surface: #ffffff; 
    --text-main: #0f172a; 
    --text-muted: #64748b; 
    --border: #e2e8f0; 
    --radius-md: 8px; 
    --scrollbar-bg: transparent;
    --scrollbar-thumb: #cbd5e1;
    --scrollbar-thumb-hover: #94a3b8;
}

body.dark-mode { 
    --bg-color: #0f172a; 
    --surface: #1e293b; 
    --text-main: #f8fafc; 
    --text-muted: #cbd5e1; 
    --border: #334155;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --scrollbar-bg: transparent;
    --scrollbar-thumb: #475569;
    --scrollbar-thumb-hover: #64748b;
}

body { font-family:'Mukta Malar', sans-serif; background:var(--bg-color); color:var(--text-main); margin:0; line-height:1.6; overflow:hidden; transition: background 0.3s, color 0.3s; }

::-webkit-scrollbar { width: 14px; height: 14px; }
::-webkit-scrollbar-track { background: var(--scrollbar-bg); }
::-webkit-scrollbar-thumb { 
    background-color: var(--scrollbar-thumb); 
    border-radius: 8px; 
    border: 4px solid transparent; 
    background-clip: padding-box; 
}
::-webkit-scrollbar-thumb:hover { background-color: var(--scrollbar-thumb-hover); }

#dashboard, #login-screen, #custom-modal, #image-modal, #gallery-modal, #preview-modal, #pagination-controls {
    display: none;
}
.d-none { display: none !important; }
.lang-ta, .lang-en { display: none; } 

.loader-icon { font-size: 42px; margin-bottom: 15px; animation: pulse-glow 1.5s infinite; border-radius: 50%; display: inline-block;}
.loader-text { color: #94a3b8; }
.login-logo { font-size: 42px; margin-bottom: 10px; }
.login-title { color: white; margin: 0 0 10px 0; font-size: 26px; font-weight: 700; }
.login-desc { color: #cbd5e1; margin-bottom: 30px; font-size: 14px; }
.modal-msg { color:var(--text-muted); margin-bottom:20px; }
.modal-header-title { color:var(--text-main); margin-top:0; }
.input-align-left { text-align:left; margin-bottom: 15px; }
.reset-margin { margin-bottom: 0 !important; margin: 0; }
.gallery-modal-box { max-width: 800px; width: 95%; }
.gallery-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 15px; }
.gallery-title { margin: 0; color: var(--text-main); }
.btn-close-transparent { background: transparent; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }
.gallery-loader { padding: 40px 0; color: var(--text-muted); font-weight: 600; }

.preview-modal-bg { background: rgba(15, 23, 42, 0.95); }
.preview-layout { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; padding: 20px; box-sizing: border-box; }
.preview-header { width: 100%; display: flex; justify-content: space-between; max-width: 1000px; align-items: center; margin-bottom: 15px; }
.preview-title { color: white; margin: 0; }
.btn-preview-close { background: #ef4444; color: white; border: none; padding: 8px 15px; border-radius: 6px; cursor: pointer; font-weight: bold; }
.mobile-logo-box { display: flex; align-items: center; gap: 8px; }
.mobile-logo-icon { font-size: 22px; }
.sidebar-top-actions { padding: 0 15px 10px 15px; border-bottom: 1px solid var(--border); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.icon-action-btn { flex-shrink: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; height: 34px; width: 34px; display: flex; align-items: center; justify-content: center; font-size: 16px; padding: 0; color: var(--text-main); }

.custom-dropdown-container { position: relative; flex: 1; min-width: 0; display: inline-block; }
.blog-selector { width: 100%; padding: 1px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-color); color: var(--text-main); font-size: 14px; font-weight: bold; font-family: inherit; cursor: pointer; outline: none; height: 34px; text-align: left; display: flex; align-items: center; justify-content: space-between; gap: 4px; box-sizing: border-box; min-width: 0; }
.blog-selector::after { content: '▼'; font-size: 10px; color: var(--text-muted); }
.custom-dropdown-list { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 1010; max-height: 200px; overflow-y: auto; margin-top: 4px; padding: 4px 0; }
.custom-dropdown-list.show { display: block; }
.custom-dropdown-item { padding: 8px 12px; cursor: pointer; color: var(--text-main); font-size: 14px; transition: background 0.2s; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; text-align: left; }
.custom-dropdown-item:hover { background: #f1f5f9; color: var(--primary); }
.dark-mode .custom-dropdown-item:hover { background: #334155; color: var(--primary); }

.lang-switcher { border-top: 1px solid var(--border); padding-top: 15px; margin-top: 15px; }
.dropdown-icon { margin-right: 8px; }
.stat-date { font-size:24px; margin-top:8px; }
.reset-top-margin { margin-top: 0 !important; }
.top-post-box { padding: 15px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-color); margin-top: 10px; }
.top-post-title { font-weight: bold; margin: 0 0 5px 0; }
.top-post-views { margin: 0; color: var(--text-muted); font-size: 14px; }
.write-layout { height: 100%; }
.write-card { display: flex; flex-direction: column; height: 100%; position: relative; }
.title-group { margin-bottom: 10px; display: flex; gap: 10px; position: relative; align-items: center; }
.title-input-box { position: relative; flex: 1; }
.write-title-input { font-size: 18px; font-weight: bold; width: 100%; padding-right: 110px; }
.auto-save-msg { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--success); opacity: 0; transition: 0.3s; font-weight: 600; pointer-events: none; }
.btn-ai-write { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: white; border: none; border-radius: 8px; padding: 0 15px; font-weight: bold; cursor: pointer; white-space: nowrap; transition: 0.3s; box-shadow: 0 4px 6px rgba(99, 102, 241, 0.2); font-size: 14px; height: 100%; min-height: 44px; }
.write-toolbar-row { display:flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 15px; flex-wrap: wrap; }
.media-tools { display:flex; gap:8px; align-items: center; }
.select-img-size { width:auto; margin:0; padding: 6px 10px; font-size: 13px; }
.btn-tool-upload { background:#eff6ff; border:1px solid #bfdbfe; border-radius:6px; cursor:pointer; font-weight:600; color:#2563eb; padding: 6px 12px; margin:0; transition:0.2s; font-size: 13px; }
.btn-tool-gallery { background:var(--surface); border:1px solid var(--border); border-radius:6px; cursor:pointer; font-weight:600; color:var(--text-main); padding: 6px 12px; margin:0; transition:0.2s; font-size: 13px; }

.btn-tool-mic { background:#fef2f2; border:1px solid #fecaca; border-radius:6px; cursor:pointer; font-weight:600; color:#dc2626; padding: 6px 12px; margin:0; transition:0.2s; font-size: 13px; display: flex; align-items: center; gap: 5px; }
.btn-tool-mic.recording { background: #fee2e2; border-color: #fca5a5; color: #ef4444; animation: mic-pulse 1.5s infinite; }
.dark-mode .btn-tool-mic.recording { background: #450a0a; border-color: #991b1b; color: #f87171; }
@keyframes mic-pulse { 0% { opacity: 1; } 50% { opacity: 0.6; } 100% { opacity: 1; } }

.notification-box { flex: 1; position: relative; min-width: 150px; height: 34px; overflow: hidden; }
.flex-min-width { flex: 1; min-width: 200px; max-width: 300px; }
.permalink-input { margin:0; padding: 6px 12px; font-size: 13px; }
.editor-container { flex: 1; display: flex; flex-direction: column; margin-bottom: 10px; min-height: 350px; position: relative; }
.flex-fill { flex: 1; }
.publish-toolbar { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.publish-item { flex: 1; }
.labels-box { flex: 2; min-width: 150px; }
.schedule-box { flex: 1.5; min-width: 140px; }
.preview-box { min-width: 100px; }
.btn-publish-box { flex: 1.5; min-width: 120px; }
.h-full { height: 100%; }
.p-small { padding: 8px; }
.p-small-btn { padding: 6px 12px; font-size: 13px; }
.manage-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; flex-wrap: wrap; gap: 10px; }
.manage-title-box { display: flex; align-items: center; gap: 10px; }
.manage-title-text { margin:0; font-size: 20px; }
.search-input { width: 100%; max-width: 250px; padding: 8px; margin: 0; }
.pagination-box { justify-content: space-between; align-items: center; margin-top: 15px; border-top: 1px solid var(--border); padding-top: 15px; }
.page-info-text { font-weight: 600; color: var(--text-muted); font-size: 13px; }
.comments-header { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.comments-title { margin:0; font-size: 20px; }
.footer-brand { color: var(--text-main); }
.footer-link { color: var(--primary); text-decoration: none; font-weight: 600; }
.footer-divider { color: var(--border); }

.app-layout { display:flex; height:100vh; }
.sidebar { width:260px; background:var(--surface); border-right:1px solid var(--border); display:flex; flex-direction:column; padding:5px 0 0 0; transition: background 0.3s, border-color 0.3s; position: relative; z-index: 1001; }
.sidebar h2 { color:var(--primary); padding:0 0px 15px; margin:0 0 10px; border-bottom:1px solid var(--border); font-size:22px; }
.menu-item { padding:10px 25px; color:var(--text-muted); font-weight:600; cursor:pointer; display:flex; gap:10px; border-left:4px solid transparent; transition:0.2s; }
.menu-item:hover { background:#f1f5f9; color:var(--primary); }
.dark-mode .menu-item:hover { background:#334155; color:var(--primary); }
.menu-item.active { background:#eff6ff; color:var(--primary); border-left-color:var(--primary); }
.dark-mode .menu-item.active { background:#1e3a8a; border-left-color:#60a5fa; color:#60a5fa; }
.mobile-header { display: none; }
.sidebar-overlay { display: none; }
.main-content { flex:1; padding:10px; overflow-y:hidden; box-sizing:border-box; display: flex; flex-direction: column; position: relative;} 

.user-profile-container { padding: 15px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 12px; cursor: pointer; transition: background 0.2s; margin-top: auto; }
.user-profile-container:hover { background: #f1f5f9; }
.dark-mode .user-profile-container:hover { background: #334155; }
.user-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary); background: var(--bg-color); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.user-info-box { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.user-name { font-size: 14px; font-weight: 700; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.user-role { font-size: 12px; color: var(--text-muted); line-height: 1.2; margin-top: 2px; }
.user-menu-icon { color: var(--text-muted); font-weight: bold; }
.user-dropdown { position: absolute; bottom: 70px; left: 15px; right: 15px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: 0 10px 25px rgba(0,0,0,0.15); display: none; flex-direction: column; z-index: 1002; overflow: hidden; }
.user-dropdown.show { display: flex; animation: fadeIn 0.2s; }
.dropdown-item { padding: 12px 15px; cursor: pointer; font-size: 14px; font-weight: 600; display: flex; align-items: center; transition: 0.2s; color: var(--text-main); }
.dropdown-item:hover { background: #f1f5f9; }
.dark-mode .dropdown-item:hover { background: #334155; }
.dropdown-item-danger { color: var(--danger); border-top: 1px solid var(--border); }
.dropdown-item-danger:hover { background: #fef2f2; color: #b91c1c; }
.dark-mode .dropdown-item-danger:hover { background: #450a0a; color: #f87171; }

.view-section { display:none; animation:fadeIn 0.3s; flex: 1; flex-direction: column; overflow-y: auto; padding-right: 0px; } 
.view-section.active { display:flex; }
@keyframes fadeIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
@keyframes pulse-glow { 0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(37, 99, 235, 0); } 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); } }

.stat-cards { display:flex; gap:10px; margin-bottom:10px; flex-wrap: wrap; }
.stat-card { flex:1; min-width: 200px; background:var(--surface); border:1px solid var(--border); padding:20px; border-radius:var(--radius-md); text-align:center; box-shadow:0 1px 3px rgba(0,0,0,0.05); transition: 0.3s; }
.stat-card h3 { margin:0 0 10px; color:var(--text-muted); font-size:16px; }
.stat-card .value { font-size:32px; font-weight:700; color:var(--primary); margin:0; }
.cms-card { background:var(--surface); border-radius:var(--radius-md); padding:10px; border:1px solid var(--border); box-shadow:0 1px 3px rgba(0,0,0,0.05); transition: 0.3s; display: flex; flex-direction: column; flex: 1; }
.form-group { margin-bottom:15px; }
.general-label { display:block; font-weight:600; margin-bottom:8px; color:var(--text-main); }
input[type="text"], select { width:100%; padding:10px 12px; font-size:15px; border:1px solid var(--border); border-radius:var(--radius-md); background:var(--surface); color:var(--text-main); font-family:inherit; box-sizing:border-box; outline:none; transition:0.2s; }
input[type="text"]::placeholder { color: var(--text-muted); font-weight: 400; opacity: 0.7; }
input:focus, select:focus { border-color:var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.publish-btn { background:var(--primary); color:white; border:none; padding:12px; font-size:16px; font-weight:700; width:100%; border-radius:var(--radius-md); cursor:pointer; transition:0.2s; display: flex; justify-content: center; align-items: center; }
.publish-btn:hover { background:var(--primary-hover); }
.action-btn { padding:6px 10px; border:none; border-radius:4px; cursor:pointer; font-weight:600; font-size:12px; margin-left:2px; margin-right:2px; transition:0.2s; text-align: center; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 4px;}
.btn-edit { background:var(--primary); color:white; } .btn-edit:hover { background:var(--primary-hover); }
.btn-draft { background:#f59e0b; color:white; } .btn-draft:hover { background:#d97706; }
.btn-delete { background:var(--danger); color:white; } .btn-delete:hover { background:#b91c1c; }
.btn-secondary { background:var(--border); color:var(--text-main); border:none; padding:12px; font-size:15px; font-weight:700; border-radius:var(--radius-md); cursor:pointer; transition:0.2s; display: flex; justify-content: center; align-items: center; white-space: nowrap;}
.btn-secondary:hover { opacity: 0.8; }
.btn-refresh { background: var(--surface); color: var(--text-main); border: 1px solid var(--border); padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.btn-refresh:hover { background: var(--border); }

#toast-container { position:fixed; bottom:30px; left:50%; transform:translateX(-50%); z-index:9999; display:flex; flex-direction:column; gap:10px; align-items:center; }
.toast { padding:10px 24px; border-radius:30px; font-size:14px; font-weight:600; color:white; transform:translateY(100px); opacity:0; transition:0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55); box-shadow:0 4px 15px rgba(0,0,0,0.2); text-align:center; }
.toast.show { transform:translateY(0); opacity:1; }
.toast-success { background:var(--success); } .toast-error { background:var(--danger); } .toast-info { background:#334155; }
.modal-overlay { display:none; position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.6); z-index:10000; align-items:center; justify-content:center; backdrop-filter:blur(4px); animation:fadeIn 0.2s; }
.modal-content { background:var(--surface); padding:30px; border-radius:var(--radius-md); text-align:center; max-width:400px; width:90%; box-shadow:0 10px 25px rgba(0,0,0,0.2); border:1px solid var(--border); }
.modal-content h3 { margin-top:0; color:var(--text-main); }
.modal-actions { display:flex; justify-content:center; gap:15px; margin-top:25px; }
.modal-btn { padding:10px 20px; border:none; border-radius:6px; cursor:pointer; font-weight:600; font-size:15px; }
.modal-btn-confirm { background:var(--primary); color:white; }
.modal-btn-cancel { background:var(--border); color:var(--text-main); }

#login-screen { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: linear-gradient(rgba(15, 23, 42, 0.75), rgba(15, 23, 42, 0.95)), url('https://ul.lawtamil.in/bg2.webp') no-repeat center center; background-size: cover; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 99999; }
#startup-loader { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: #0f172a; display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 100000; color: white; font-size: 16px; font-weight: bold; }
.login-card { background: rgba(30, 41, 59, 0.65); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255, 255, 255, 0.1); padding: 40px 30px; border-radius: 24px; text-align: center; max-width: 400px; width: 90%; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); }
.btn-google { background: #ffffff; color: #3c4043; border: 1px solid #dadce0; padding: 12px 20px; font-size: 15px; font-weight: 600; border-radius: 8px; cursor: pointer; width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px; transition: 0.2s; box-shadow: 0 1px 2px 0 rgba(60,64,67,0.3); }
.btn-google:hover { background: #f8f9fa; box-shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15); }
.trust-indicator { margin-top: 25px; font-size: 12px; color: #94a3b8; display: flex; align-items: center; justify-content: center; gap: 6px; }

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 15px; margin-top: 20px; max-height: 50vh; overflow-y: auto; padding: 10px; }
.gallery-item { position: relative; border-radius: 8px; overflow: hidden; cursor: pointer; border: 2px solid transparent; transition: 0.2s; background: #e2e8f0; aspect-ratio: 1; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.gallery-item:hover { border-color: var(--primary); transform: scale(1.05); }
.dark-mode .gallery-item { background: #334155; }

.preview-wrapper { width: 100%; height: calc(100vh - 100px); background: #f1f5f9; border-radius: 12px; overflow: hidden; transition: 0.3s; margin: 0 auto; border: 10px solid #334155; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1); }
.preview-wrapper.mobile-view { max-width: 375px; height: 750px; border-radius: 36px; border: 14px solid #0f172a; }
.preview-wrapper iframe { width: 100%; height: 100%; border: none; background: white; }
.device-toggles { display: flex; justify-content: center; gap: 10px; margin-bottom: 20px; }
.device-btn { background: var(--surface); color: var(--text-main); border: 1px solid var(--border); padding: 8px 16px; border-radius: 20px; cursor: pointer; font-weight: 600; }
.device-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.tox-tinymce { border-radius: var(--radius-md) !important; flex: 1; min-height: 350px !important; }
.cms-footer { margin-top: auto; padding-top: 10px; font-size: 12px; color: var(--text-muted); display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; }
.cms-footer-links { display: flex; gap: 10px; align-items: center; }
#write-notification-area { position: absolute; width: 100%; text-align: center; top: 50%; transform: translateY(-50%); font-size: 13px; font-weight: 600; opacity: 0; transition: 0.3s; pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 768px) {
    body { overflow-y: auto; height: auto; }
    .app-layout { flex-direction: column; height: 100vh; }
    .mobile-header { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; background: var(--surface); border-bottom: 1px solid var(--border); z-index: 999; }
    .mobile-header h2 { margin: 0; font-size: 20px; color: var(--primary); font-weight: 700; }
    .menu-toggle-btn { background: none; border: none; font-size: 24px; color: var(--text-main); cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center;}
    .sidebar { position: fixed; top: 0; left: -300px; width: 280px; height: 100vh; height: 100dvh; z-index: 1001; transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 4px 0 15px rgba(0,0,0,0.1); overflow-y: auto; padding-bottom: 20px; }
    .sidebar.open { left: 0; }
    .sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.5); z-index: 1000; backdrop-filter: blur(2px); }
    .sidebar-overlay.active { display: block; animation: fadeIn 0.3s; }
    .main-content { padding: 10px; height: calc(100vh - 60px); overflow-y: auto; }
    .stat-cards { flex-direction: column; gap: 10px; margin-bottom: 15px; }
    .write-toolbar-row { flex-direction: column; align-items: stretch !important; gap: 10px !important; }
    .permalink-box { order: -1; max-width: 100% !important; }
    .media-tools { order: 0; }
    .notification-box { order: 1; }
    .form-group > div[style*="display:flex"] { flex-direction: column; align-items: stretch !important; gap: 10px !important; }
    #img-size-select { width: 100% !important; margin-bottom: 5px; }
    #posts-list > div, #comments-list > div { flex-direction: column; align-items: flex-start !important; gap: 10px !important; }
    #posts-list > div > div:last-child, #comments-list > div > div:last-child { width: 100%; flex-wrap: wrap; gap: 8px; justify-content: flex-start; }
    .action-btn { flex: 1; text-align: center; padding: 8px 5px; font-size: 11px; white-space: nowrap; }
    .modal-content { padding: 20px; }
    .modal-btn { flex: 1; }
    .cms-footer { flex-direction: column; gap: 5px; text-align: center; padding-bottom: 15px;}
    .user-profile-container { margin-top: auto; padding-bottom: 30px; margin-bottom: 20px; }
    .user-dropdown { bottom: 90px; }
}

.ws-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-left: 8px; opacity: 0; transition: 0.3s; background-color: var(--success); }

.qr-desc { color: var(--text-muted); font-size: 14px; margin-bottom: 15px; }
.qr-code-wrapper { background: white; padding: 15px; border-radius: 12px; display: inline-block; margin-bottom: 15px; }
.qr-img-box { width: 200px; height: 200px; }
.qr-link-box { display: flex; gap: 8px; margin-bottom: 15px; align-items: center; width: 100%; }
.qr-input-url { flex: 1; padding: 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-color); color: var(--text-main); font-size: 13px; outline: none; }
.btn-copy { background: var(--primary); color: white; border: none; padding: 10px 15px; border-radius: 6px; cursor: pointer; font-weight: bold; font-size: 13px; white-space: nowrap; transition: 0.2s; }
.btn-copy:hover { background: var(--primary-hover); }

.vt-modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.6); display: flex; justify-content: center; align-items: center; z-index: 9999; backdrop-filter: blur(3px); animation: fadeIn 0.2s; }
.vt-modal-card { background: var(--surface); padding: 25px; border-radius: 12px; width: 90%; max-width: 380px; text-align: center; box-shadow: 0 10px 25px rgba(0,0,0,0.2); border: 1px solid var(--border); }
.vt-modal-title { margin-top: 0; color: var(--text-main); font-size: 18px; margin-bottom: 10px; }
.vt-modal-desc { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }

.vt-btn-group { display: flex; gap: 10px; margin-bottom: 15px; }
.vt-btn { flex: 1; padding: 12px 10px; border: none; border-radius: 8px; font-size: 14px; cursor: pointer; font-weight: bold; color: white; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 6px; }

.vt-btn-pc { background: var(--primary); }
.vt-btn-pc:hover { background: var(--primary-hover); }

.vt-btn-mobile { background: #0ea5e9; }
.vt-btn-mobile:hover { background: #0284c7; }

.vt-btn-stop { width: 100%; background: var(--danger); margin-bottom: 15px; padding: 12px; border: none; border-radius: 8px; font-size: 14px; font-weight: bold; color: white; cursor: pointer; transition: 0.2s; }
.vt-btn-stop:hover { background: #b91c1c; }

.vt-modal-actions { display: flex; justify-content: center; margin-top: 10px; padding-top: 15px; border-top: 1px solid var(--border); }
.vt-btn-close { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-weight: bold; font-size: 14px; padding: 8px 15px; border-radius: 6px; transition: 0.2s; }
.vt-btn-close:hover { color: var(--text-main); background: var(--border); }

.youtube-player { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; background: #000; margin: 15px 0; border-radius: 8px;}
.youtube-player iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 100; background: transparent; }
.youtube-player img { object-fit: cover; display: block; left: 0; bottom: 0; margin: auto; max-width: 100%; width: 100%; position: absolute; right: 0; top: 0; border: none; height: auto; cursor: pointer; transition: 0.4s all; }
.youtube-player img:hover { filter: brightness(75%); }
.youtube-player .play { height: 72px; width: 72px; left: 50%; top: 50%; margin-left: -36px; margin-top: -36px; position: absolute; background: url("https://upload.wikimedia.org/wikipedia/commons/b/b8/YouTube_play_button_icon_%282013%E2%80%932017%29.png") no-repeat; background-size: contain; cursor: pointer; }

blockquote.lawtamil-quote {
    border-left: 4px solid var(--primary); padding: 10px 20px; margin: 15px 0; font-size: 16px; font-weight: 600; color: var(--text-main); font-style: italic; background: transparent; }

.media-tab-btn { display: block; width: 100%; text-align: left; padding: 10px 15px; border: none; background: transparent; cursor: pointer; color: var(--text-main); font-size: 14px; font-weight: 600; border-left: 3px solid transparent; transition: 0.2s; }
.media-tab-btn:hover { background: rgba(37, 99, 235, 0.05); }
.dark-mode .media-tab-btn:hover { background: rgba(255,255,255,0.05); }
.media-tab-btn.active { color: var(--primary); border-left-color: var(--primary); background: rgba(37, 99, 235, 0.1); }

.custom-file-input { display: block; width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-color); color: var(--text-main); font-size: 14px; cursor: pointer; transition: 0.2s; box-sizing: border-box; }
.custom-file-input:hover { border-color: var(--primary); }
.custom-file-input::file-selector-button { background: var(--surface); color: var(--text-main); border: 1px solid var(--border); padding: 4px 10px; border-radius: 4px; margin-right: 10px; cursor: pointer; font-weight: 600; transition: 0.2s; font-size: 13px; }
.custom-file-input::file-selector-button:hover { background: var(--border); }
.premium-feature-text { font-size: 12px; color: #f59e0b; font-weight: bold; margin-top: 5px; }
.upload-progress-container { background: var(--surface); padding: 15px; border-radius: 8px; border: 1px solid var(--border); }
.progress-track { background: var(--bg-color); border-radius: 4px; height: 8px; overflow: hidden; width: 100%; border: 1px solid var(--border); }
.progress-fill { background: var(--success); height: 100%; width: 0%; transition: width 0.3s ease; }
.progress-status-text { font-size: 13px; text-align: center; margin-top: 8px; color: var(--text-main); font-weight: 600; }

.lawtamil-video-container { width: 100%; box-sizing: border-box; }
.lawtamil-video-container.video-horizontal { margin: 15px auto; text-align: center; max-width: 800px; display: block; }
.lawtamil-video-container.video-horizontal video { aspect-ratio: 16/9; }
.lawtamil-video-container.video-vertical { float: left; max-width: 320px; margin: 5px 20px 15px 0; }
.lawtamil-video-container video { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--border); background: transparent; display: block; }

.seo-score-excellent { color: var(--success) !important; }
.seo-score-good { color: #f59e0b !important; }
.seo-score-poor { color: var(--danger) !important; }

.internal-link-popup { position: absolute; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 4px 12px rgba(0,0,0,0.15); border-radius: 8px; padding: 12px; z-index: 1050; display: none; width: 260px; font-size: 13px; }
.internal-link-popup p { margin: 0 0 10px 0; font-weight: 600; color: var(--text-main); line-height: 1.4; }
.internal-link-actions { display: flex; gap: 8px; }
.internal-link-btn { flex: 1; padding: 6px; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; transition: 0.2s; }
.internal-link-btn-yes { background: var(--primary); color: white; }
.internal-link-btn-yes:hover { background: var(--primary-hover); }
.internal-link-btn-no { background: var(--border); color: var(--text-main); }
.internal-link-btn-no:hover { background: #cbd5e1; }

.tox .tox-tbtn--bespoke .tox-tbtn__select-label { width: 5em !important; }

#news-tabs-container { scrollbar-width: thin; scrollbar-color: var(--border) transparent; padding-bottom: 12px; scroll-behavior: smooth; }
#news-tabs-container::-webkit-scrollbar { height: 5px; }
#news-tabs-container::-webkit-scrollbar-track { background: transparent; }
#news-tabs-container::-webkit-scrollbar-thumb { background-color: var(--border); border-radius: 10px; }
#news-tabs-container::-webkit-scrollbar-thumb:hover { background-color: var(--text-muted); }

#post-search-description {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-main);
    font-size: 14px;
    transition: all 0.3s ease;
}
#post-search-description:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* --- App Launcher Styles --- */
.app-launcher-container {
    position: relative;
    display: inline-block;
}

.app-launcher-btn {
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    margin-top: -28px;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.app-launcher-btn:hover, .app-launcher-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: #f3f4f6;
}

.grid-icon {
    width: 22px;
    height: 22px;
}

.app-launcher-menu {
    position: absolute;
    top: 100%;
    left: -200px;
    margin-top: 15px;
    width: 260px;
    background: #1e293b;
    border: 1px solid #374151;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-launcher-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.app-menu-header {
    padding: 12px 15px;
    border-bottom: 1px solid #374151;
    font-size: 13px;
    font-weight: bold;
    color: #f3f4f6;
    background: rgba(0,0,0,0.1);
    border-radius: 12px 12px 0 0;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 15px;
}

.app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    gap: 8px;
    padding: 10px 4px;
    border-radius: 10px;
    transition: background 0.2s;
}

.app-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.app-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.app-name {
    font-size: 11px;
    color: #d1d5db;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

@media (max-width: 768px) {
    .app-launcher-btn {
        min-width: 36px !important;
        min-height: 36px !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-size: 0 !important;
    }

    .grid-icon {
        width: 24px !important;
        height: 24px !important;
        flex-shrink: 0 !important;
        display: block !important;
    }
}

/* ==================================================================== */
/* 📱 MOBILE VIEW PUBLISH TOOLBAR FIX (2x2 Neat Grid Layout)          */
/* ==================================================================== */
@media (max-width: 768px) {
    .publish-toolbar {
        display: grid !important;
        grid-template-columns: 3fr 2fr; /* முதல் வரிசை: Labels (60%) | Schedule (40%) */
        gap: 10px !important;
        align-items: stretch;
        margin-top: 10px;
    }

    /* 1. Labels Box (இடதுபுறம்) */
    .labels-box {
        grid-column: 1 / 2;
        min-width: 0 !important;
    }

    /* 2. Schedule Box (வலதுபுறம்) & வெள்ளை நிறத்தை மாற்றுதல் */
    .schedule-box {
        grid-column: 2 / 3;
        min-width: 0 !important;
    }

    #post-schedule {
        background: var(--surface) !important;
        color: var(--text-main) !important;
        border: 1px solid var(--border) !important;
        border-radius: var(--radius-md) !important;
        padding: 10px 8px !important;
        font-size: 13px !important;
        text-align: center;
        height: 100% !important;
        min-height: 44px; /* மொபைலில் விரலால் தொடுவதற்கு ஏற்ற உயரம் */
        box-sizing: border-box;
        cursor: pointer;
        width: 100%;
    }

    /* Schedule உள்ளீட்டில் உள்ள Placeholder நிறம் */
    #post-schedule::placeholder {
        color: var(--text-muted);
        opacity: 0.8;
    }

    /* 3. Preview Button (இரண்டாவது வரிசை - இடதுபுறம் 35% அகலம்) */
    .preview-box {
        grid-column: 1 / 2;
        min-width: 0 !important;
    }
    
    #btn-live-preview {
        width: 100%;
        min-height: 44px;
        font-size: 14px !important;
        padding: 8px !important;
    }

    /* 4. Publish Button (இரண்டாவது வரிசை - வலதுபுறம் 65% அகலம்) */
    .btn-publish-box {
        grid-column: 2 / 3;
        min-width: 0 !important;
    }
    
    #publish-btn {
        width: 100%;
        min-height: 44px;
        font-size: 15px !important;
        padding: 8px !important;
    }
}

/* ==================================================================== */
/* 📄 LAW DOCUMENT EMBED BADGE STYLES                                   */
/* ==================================================================== */

.law-doc-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background-color: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.3);
    border-radius: 6px;
    color: #1e3a8a !important;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    margin: 8px 0;
    transition: all 0.2s ease;
}

body.dark-mode .law-doc-badge {
    background-color: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    color: #60a5fa !important;
}

.law-doc-badge:hover {
    background-color: #2563eb;
    color: #ffffff !important;
    transform: translateY(-1px);
}

/* ==================================================================== */
/* 🚀 [v2.0 CMS PATCH] - OVERWRITE TOGGLE & GALLERY PAGINATION STYLES   */
/* ==================================================================== */

/* 1. Anti-FOUC Lock (பக்கம் லோட் ஆகும்போது 0.5 நொடி இரு மொழிகளும் சேர்ந்து தெரிவதைத் தடுக்க) */
.lang-ta { 
    display: none; 
}

/* 2. Overwrite Checkbox UI (ஆவணப் புதுப்பித்தல் செக்பாக்ஸ் - மொபைல் சீரமைப்பு) */
.asset-upload-box label {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: left;
    line-height: 1.4;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.asset-upload-box label:hover {
    background: rgba(220, 38, 38, 0.05);
}

.asset-upload-box input[type="checkbox"] {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    accent-color: var(--danger);
    cursor: pointer;
}

/* 3. Gallery Pagination UI (காப்பகத்தின் 'Load More' பட்டன் Grid-ல் உடையாமல் நடுவில் நிற்க) */
#gallery-loading {
    animation: galleryPulse 1.5s infinite ease-in-out;
}

@keyframes galleryPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

#btn-gallery-load-more {
    grid-column: 1 / -1;     /* அத்தனை காலங்களையும் உடைத்து முழு அகலத்தில் அமர */
    justify-self: center;
    margin: 20px auto 10px auto !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--primary);
    background: var(--surface);
    color: var(--primary);
    transition: all 0.2s ease;
}

#btn-gallery-load-more:hover {
    transform: translateY(-2px);
    background: var(--primary);
    color: white;
}

/* 4. Smart Download Card - Dark Mode Legibility Fix */
body.dark-mode .law-doc-badge {
    background-color: rgba(37, 99, 235, 0.15) !important;
    border-color: rgba(59, 130, 246, 0.3) !important;
}

body.dark-mode .law-doc-badge span[style*="color: #1e3a8a"] {
    color: #93c5fd !important; /* அடர் நீல எழுத்துகளை வெளிர் நீலத்திற்கு மாற்ற */
}
