.flash-container { margin-bottom: 20px; }
.flash-msg {
    padding: 14px 18px; border-radius: var(--radius-sm);
    margin-bottom: 10px; font-size: 14px; font-weight: 500;
    display: flex; align-items: center; justify-content: space-between;
    animation: slideDown 0.3s ease; backdrop-filter: blur(10px);
}
.flash-msg.success { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.2); }
.flash-msg.danger { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
.flash-msg.warning { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.2); }
.flash-msg.info { background: rgba(99,102,241,0.15); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.2); }
.flash-msg .close-btn { background: none; border: none; cursor: pointer; font-size: 18px; opacity: 0.5; color: inherit; }

.stat-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px; margin-bottom: 24px;
}
.stat-card {
    background: var(--card-bg); border-radius: var(--radius);
    padding: 24px; border: 1px solid var(--card-border); position: relative;
    overflow: hidden; transition: all 0.3s; backdrop-filter: blur(10px);
}
.stat-card:hover { border-color: rgba(99,102,241,0.3); transform: translateY(-2px); box-shadow: var(--glow); }
.stat-card .stat-icon {
    width: 48px; height: 48px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; margin-bottom: 16px;
}
.stat-card .stat-icon.indigo { background: rgba(99,102,241,0.15); color: var(--primary-light); }
.stat-card .stat-icon.green { background: rgba(16,185,129,0.15); color: var(--success); }
.stat-card .stat-icon.red { background: rgba(239,68,68,0.15); color: var(--danger); }
.stat-card .stat-icon.yellow { background: rgba(245,158,11,0.15); color: var(--warning); }
.stat-card .stat-value { font-size: 32px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); margin-top: 6px; font-weight: 500; }

.card-modern {
    background: var(--card-bg); border-radius: var(--radius);
    border: 1px solid var(--card-border); margin-bottom: 24px;
    overflow: hidden; backdrop-filter: blur(10px);
}
.card-modern .card-header-modern {
    padding: 20px 24px; border-bottom: 1px solid var(--glass-border);
    display: flex; align-items: center; justify-content: space-between;
}
.card-modern .card-header-modern h5 {
    font-size: 16px; font-weight: 700; margin: 0; color: var(--text);
    display: flex; align-items: center; gap: 8px;
}
.card-modern .card-body-modern { padding: 24px; }

.badge-modern {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 12px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
}
.badge-modern.reliable { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-modern.misinformation { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-modern.misleading { background: rgba(245,158,11,0.15); color: #fbbf24; }

.table-container { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
table thead { background: var(--table-header-bg); }
table th {
    padding: 12px 16px; text-align: left; font-weight: 600;
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-muted); border-bottom: 1px solid var(--border);
}
table td { padding: 12px 16px; border-bottom: 1px solid var(--border-light); color: var(--text); }
table tbody tr { transition: background 0.15s; }
table tbody tr:hover { background: var(--table-hover); }
.text-truncate { max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.form-label { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-group .form-input { width: 100%; }
.form-group select.form-input { padding: 11px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--input-bg); color: var(--text); font-size: 15px; }
.form-group select.form-input option { background: var(--select-bg); color: var(--input-color); }
.form-input {
    width: 100%; padding: 11px 16px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 14px; font-family: inherit;
    color: var(--input-color); background: var(--input-bg);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.form-input::placeholder { color: var(--text-dim); }
textarea.form-input { resize: vertical; min-height: 120px; }
select.form-input { cursor: pointer; }
select.form-input option { background: var(--select-bg); color: var(--input-color); }

.btn-modern {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 24px; border-radius: var(--radius-sm); border: none;
    font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s;
    text-decoration: none; font-family: inherit;
}
.btn-modern.primary {
    background: linear-gradient(135deg, var(--primary), #8b5cf6); color: #fff;
    box-shadow: 0 4px 15px rgba(99,102,241,0.3);
}
.btn-modern.primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99,102,241,0.4); }
.btn-modern.success { background: var(--success); color: #fff; }
.btn-modern.success:hover { background: #059669; }
.btn-modern.danger { background: var(--danger); color: #fff; }
.btn-modern.danger:hover { background: #dc2626; }
.btn-modern.outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-modern.outline:hover { border-color: var(--primary); color: var(--primary-light); }
.btn-modern.full { width: 100%; }

.progress-modern { width: 100%; height: 8px; background: var(--border-light); border-radius: 4px; overflow: hidden; }
.progress-modern .bar { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.progress-modern .bar.green { background: linear-gradient(90deg, #10b981, #34d399); }
.progress-modern .bar.red { background: linear-gradient(90deg, #ef4444, #f87171); }
.progress-modern .bar.yellow { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.avatar-sm {
    width:34px; height:34px; border-radius:50%;
    background:linear-gradient(135deg,var(--primary),#8b5cf6);
    display:flex; align-items:center; justify-content:center;
    color:#fff; font-weight:600; font-size:13px;
    box-shadow:0 0 12px rgba(99,102,241,0.3);
}
.avatar-lg {
    width: 96px; height: 96px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    display: flex; align-items: center; justify-content: center;
    font-size: 36px; font-weight: 800; color: #fff; margin: 0 auto 16px;
    box-shadow: 0 0 30px rgba(99,102,241,0.3);
}

.model-card {
    border-radius: var(--radius); padding: 20px; border: 1px solid var(--card-border);
    transition: all 0.3s; height: 100%; background: var(--card-bg); backdrop-filter: blur(10px);
}
.model-card:hover { border-color: rgba(99,102,241,0.3); box-shadow: var(--glow); }
.model-card .model-name { font-size: 14px; font-weight: 700; margin-bottom: 12px; color: var(--text); }
.model-card .model-pred { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.model-card .model-conf { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }

.empty-state { text-align: center; padding: 60px 20px; }
.empty-state i { font-size: 48px; color: var(--text-dim); margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: var(--text-dim); }

.pagination-modern { display: flex; gap: 4px; list-style: none; padding: 0; justify-content: center; margin-top: 24px; }
.pagination-modern a, .pagination-modern span {
    padding: 8px 14px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; text-decoration: none;
    border: 1px solid var(--border); color: var(--text); display: inline-block;
}
.pagination-modern a:hover { background: rgba(99,102,241,0.1); border-color: var(--primary); }
.pagination-modern .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination-modern .disabled { opacity: 0.4; pointer-events: none; }
.pagination-modern .ellipsis { border: none; padding: 8px 6px; color: var(--text-dim); letter-spacing: 2px; }

.upload-area {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 40px 20px; text-align: center; transition: all 0.2s; cursor: pointer;
}
.upload-area:hover { border-color: var(--primary); background: rgba(99,102,241,0.05); }
.upload-area i { font-size: 40px; color: var(--primary); margin-bottom: 12px; }
.upload-area p { color: var(--text-muted); font-size: 14px; margin: 0; }
.upload-area input[type="file"] { display: none; }

.prediction-result {
    border-radius: var(--radius); padding: 28px; text-align: center;
    margin-top: 24px; animation: fadeIn 0.5s ease; backdrop-filter: blur(10px);
}
.prediction-result.reliable { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); }
.prediction-result.misinformation { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); }
.prediction-result.misleading { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); }
.prediction-result .pred-icon { font-size: 48px; margin-bottom: 12px; }
.prediction-result .pred-label { font-size: 24px; font-weight: 800; margin-bottom: 8px; color: var(--text); }
.prediction-result .pred-confidence { font-size: 16px; color: var(--text-muted); margin-bottom: 20px; }

.text-muted-modern { color: var(--text-muted); }
.text-center-modern { text-align: center; }
.mb-24 { margin-bottom: 24px; }
.dashboard-charts > * { min-width: 0; }
.stat-grid > * { min-width: 0; }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    display: none; align-items: center; justify-content: center;
    z-index: 1000; padding: 20px; backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: var(--card-bg); border: 1px solid var(--card-border);
    border-radius: var(--radius); width: 100%; max-height: 90vh; overflow-y: auto;
    animation: slideUp 0.3s ease;
}
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-head h4 { margin: 0; font-size: 18px; font-weight: 700; color: var(--text); }
.modal-head .close-btn {
    background: none; border: none; font-size: 24px; cursor: pointer;
    color: var(--text-muted); line-height: 1;
}

/* ═══ COMPONENTS MAGIC ═══ */

/* Stat cards: lift + icon float on hover */
.stat-card { transition: opacity 0.6s cubic-bezier(0.16,1,0.3,1), transform 0.3s cubic-bezier(0.16,1,0.3,1), box-shadow 0.3s ease, border-color 0.3s ease; }
.stat-card:hover { transform: translateY(-4px); box-shadow: 0 12px 40px rgba(99,102,241,0.18); }
.stat-card .stat-icon { transition: transform 0.35s cubic-bezier(0.16,1,0.3,1); }
.stat-card:hover .stat-icon { transform: translateY(-4px) scale(1.08); }
.stat-card .stat-value { transition: color 0.3s ease; }

/* Card-modern: hover glow + border accent */
.card-modern { position: relative; transition: opacity 0.6s cubic-bezier(0.16,1,0.3,1), transform 0.3s cubic-bezier(0.16,1,0.3,1), box-shadow 0.3s ease, border-color 0.3s ease; }
.card-modern:hover { transform: translateY(-3px); border-color: rgba(99,102,241,0.3); box-shadow: 0 14px 44px rgba(0,0,0,0.25); }

/* Buttons: shimmer on primary */
.btn-modern.primary { position: relative; overflow: hidden; }
.btn-modern.primary::after {
    content: ''; position: absolute; top: 0; left: -60%;
    width: 40%; height: 100%;
    background: linear-gradient(105deg, transparent, rgba(255,255,255,0.22), transparent);
    transform: skewX(-20deg); pointer-events: none;
    transition: left 0.6s ease;
}
.btn-modern.primary:hover::after { left: 130%; }
.btn-modern.primary:active { transform: translateY(0) scale(0.98); }

/* Modal: pop-in */
.modal-box { animation: popIn 0.32s cubic-bezier(0.16,1,0.3,1); }

/* Table rows subtle fade-in on hover */
table tbody tr { transition: background 0.15s ease, transform 0.2s ease; }
table tbody tr:hover { transform: translateX(2px); }

/* Flash messages: gentle entrance */
.flash-msg { position: relative; overflow: hidden; }
.flash-msg::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: currentColor; opacity: 0.6;
}
.flash-msg i { animation: iconPop 0.4s cubic-bezier(0.16,1,0.3,1); }
@keyframes iconPop { 0% { opacity: 0; transform: scale(0.5) rotate(-10deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }

/* Badges: subtle lift */
.badge-modern { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.badge-modern:hover { transform: translateY(-1px) scale(1.04); }

/* Progress bars: animated fill */
.progress-modern .bar, .r-bar .bar-fill { animation: barGrow 0.8s cubic-bezier(0.16,1,0.3,1); }
@keyframes barGrow { from { width: 0 !important; } }
/* Global action progress: visible for form submissions, requests, and navigation. */
#pmdGlobalProgress { position:fixed; inset:0; z-index:100000; pointer-events:none; opacity:0; visibility:hidden; transition:opacity .16s ease,visibility .16s ease; }
#pmdGlobalProgress.active { opacity:1; visibility:visible; }
.pmd-global-progress-track { position:absolute; left:0; right:0; top:0; height:4px; background:rgba(99,102,241,.13); overflow:hidden; }
.pmd-global-progress-track span { display:block; width:38%; height:100%; background:linear-gradient(90deg,#6366f1,#22d3ee,#8b5cf6); border-radius:0 4px 4px 0; animation:pmdProgressSweep 1.05s cubic-bezier(.4,0,.2,1) infinite; box-shadow:0 0 14px rgba(99,102,241,.7); }
.pmd-global-progress-pill { position:absolute; top:18px; left:50%; transform:translate(-50%,-9px); display:flex; align-items:center; gap:10px; min-width:150px; justify-content:center; padding:10px 16px; color:var(--text); background:var(--card-bg); border:1px solid var(--border); border-radius:999px; box-shadow:0 14px 45px rgba(15,23,42,.22); backdrop-filter:blur(16px); font-size:12px; font-weight:800; opacity:0; transition:opacity .16s ease,transform .16s ease; }
#pmdGlobalProgress.active .pmd-global-progress-pill { opacity:1; transform:translate(-50%,0); }
.pmd-global-progress-spinner { width:16px; height:16px; flex:0 0 auto; border:2px solid rgba(99,102,241,.2); border-top-color:var(--primary); border-radius:50%; animation:pmdProgressSpin .7s linear infinite; }
.pmd-action-loading { position:relative; cursor:wait !important; opacity:.82; }
.pmd-action-loading::after { content:''; display:inline-block; width:12px; height:12px; margin-left:8px; vertical-align:-1px; border:2px solid currentColor; border-right-color:transparent; border-radius:50%; animation:pmdProgressSpin .7s linear infinite; }
.pmd-action-loading.loading::after,.pmd-action-loading:has(.fa-spinner)::after { display:none; }
.pmd-action-loading > .fa-spinner.fa-spin { display:inline-block; }
@keyframes pmdProgressSpin { to { transform:rotate(360deg); } }
@keyframes pmdProgressSweep { 0% { transform:translateX(-110%); } 100% { transform:translateX(365%); } }
@media (prefers-reduced-motion: reduce) { .pmd-global-progress-track span,.pmd-global-progress-spinner,.pmd-action-loading::after { animation-duration:1.8s; } }
