/* =========================================================================
   DOC/DOCX Metadata Editor — Style
   Professional • Modern • Glassmorphism • Dark/Light Mode
   Asosiy tema: ko'k (blue) + gradient
   ========================================================================= */

:root {
    --brand-1: #2563eb;
    --brand-2: #4f46e5;
    --brand-3: #06b6d4;
    --brand-gradient: linear-gradient(135deg, #2563eb 0%, #4f46e5 55%, #06b6d4 100%);

    --bg-body: #eef2f9;
    --bg-blob-1: rgba(37, 99, 235, 0.25);
    --bg-blob-2: rgba(6, 182, 212, 0.22);

    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 8px 32px rgba(31, 41, 90, 0.12);

    --text-main: #1e293b;
    --text-muted: #64748b;
    --card-radius: 18px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- DARK MODE ---------- */
[data-bs-theme="dark"] {
    --bg-body: #0b1120;
    --bg-blob-1: rgba(37, 99, 235, 0.35);
    --bg-blob-2: rgba(6, 182, 212, 0.28);

    --glass-bg: rgba(23, 32, 51, 0.72);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);

    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
}

/* ---------- BASE ---------- */
* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    transition: background var(--transition), color var(--transition);
}

/* Fon gradient bloblari (glass effekt uchun) */
body::before,
body::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    z-index: -1;
    animation: floatBlob 14s ease-in-out infinite alternate;
}
body::before {
    width: 480px; height: 480px;
    background: var(--bg-blob-1);
    top: -120px; left: -100px;
}
body::after {
    width: 520px; height: 520px;
    background: var(--bg-blob-2);
    bottom: -160px; right: -120px;
    animation-delay: -6s;
}
@keyframes floatBlob {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(40px, 30px) scale(1.15); }
}

/* ---------- GLASSMORPHISM ---------- */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* ---------- NAVBAR ---------- */
.app-navbar {
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    padding: 0.65rem 0;
}
.brand-logo {
    width: 46px; height: 46px;
    border-radius: 13px;
    display: grid; place-items: center;
    background: var(--brand-gradient);
    color: #fff; font-size: 1.35rem;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
}
.brand-title {
    font-weight: 700; font-size: 1.12rem;
    line-height: 1.1; color: var(--text-main);
}
.brand-subtitle {
    font-size: 0.75rem; color: var(--text-muted);
}
.com-badge {
    font-weight: 600; padding: 0.45em 0.75em;
    border-radius: 10px; display: inline-flex;
    align-items: center; gap: 0.35em;
}
.com-ok  { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.com-off { background: rgba(239, 68, 68, 0.15);  color: #ef4444; }

.btn-theme-toggle {
    width: 42px; height: 42px; border-radius: 12px;
    display: grid; place-items: center;
    border: 1px solid var(--glass-border);
    background: transparent; color: var(--text-main);
    transition: var(--transition);
}
.btn-theme-toggle:hover {
    background: var(--brand-gradient); color: #fff;
    transform: rotate(-15deg) scale(1.05);
}

/* ---------- CARDS ---------- */
.app-card {
    border-radius: var(--card-radius);
    border: 1px solid var(--glass-border);
    overflow: hidden;
    animation: fadeUp 0.5s ease both;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}
.app-card-header {
    background: transparent;
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 1.25rem;
    display: flex; align-items: center; justify-content: space-between;
    color: var(--text-main);
}
.app-card-header h5 { font-weight: 700; font-size: 1rem; }
.app-card-footer {
    background: transparent;
    border-top: 1px solid var(--glass-border);
    padding: 0.75rem 1.25rem;
}

/* ---------- STAT CARDS ---------- */
.stat-card {
    border-radius: 16px; padding: 1rem 1.1rem;
    display: flex; align-items: center; gap: 0.9rem;
    transition: var(--transition);
    animation: fadeUp 0.5s ease both;
}
.stat-card:hover { transform: translateY(-4px); }
.stat-icon {
    width: 48px; height: 48px; border-radius: 13px;
    display: grid; place-items: center; font-size: 1.25rem;
    flex-shrink: 0;
}
.bg-primary-soft   { background: rgba(37, 99, 235, 0.15);  color: #2563eb; }
.bg-info-soft      { background: rgba(6, 182, 212, 0.15);  color: #06b6d4; }
.bg-success-soft   { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.bg-danger-soft    { background: rgba(239, 68, 68, 0.15);  color: #ef4444; }
.bg-warning-soft   { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.bg-secondary-soft { background: rgba(100, 116, 139, 0.15);color: #64748b; }
.stat-value { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ---------- FORM ---------- */
.form-label { font-size: 0.82rem; font-weight: 600; color: var(--text-main); margin-bottom: 0.3rem; }
.form-control, .input-group-text {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    border-radius: 11px;
    transition: var(--transition);
}
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .input-group-text {
    background: rgba(255, 255, 255, 0.05);
}
.form-control:focus {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--brand-1);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.18);
    color: var(--text-main);
}
[data-bs-theme="dark"] .form-control:focus { background: rgba(255, 255, 255, 0.08); }
.form-control::placeholder { color: var(--text-muted); opacity: 0.7; }
.input-group-text { color: var(--brand-1); }
.search-input { max-width: 180px; }

/* ---------- BUTTONS ---------- */
.btn { border-radius: 11px; font-weight: 600; transition: var(--transition); }
.btn-primary {
    background: var(--brand-gradient); border: none;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(37, 99, 235, 0.5); }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); border: none; }
.btn-success:hover:not(:disabled) { transform: translateY(-2px); }
.btn-danger  { background: linear-gradient(135deg, #ef4444, #dc2626); border: none; }
.btn-ghost {
    border: 1px solid var(--glass-border);
    color: var(--text-main); background: transparent;
}
.btn-ghost:hover { background: var(--brand-gradient); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- DROPZONE ---------- */
.dropzone {
    border: 2px dashed rgba(37, 99, 235, 0.4);
    border-radius: 16px;
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(37, 99, 235, 0.03);
}
.dropzone:hover {
    border-color: var(--brand-1);
    background: rgba(37, 99, 235, 0.08);
    transform: translateY(-2px);
}
.dropzone.dragover {
    border-color: var(--brand-1);
    background: rgba(37, 99, 235, 0.14);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
.dropzone-inner { pointer-events: none; }
.dropzone-inner .btn { pointer-events: auto; }
.dropzone-icon {
    font-size: 2.6rem;
    color: var(--brand-1);
    margin-bottom: 0.6rem;
    display: block;
    animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.dropzone-title { font-weight: 700; color: var(--text-main); font-size: 1.02rem; }
.dropzone-sub { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.25rem; }
.mode-info {
    color: var(--text-muted);
    background: rgba(100, 116, 139, 0.1);
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
    line-height: 1.4;
}

/* ---------- SWITCH ---------- */
.form-check-input { cursor: pointer; }
.form-check-input:checked { background-color: var(--brand-1); border-color: var(--brand-1); }
.form-check-label { color: var(--text-main); font-weight: 500; }

/* ---------- PROGRESS ---------- */
.app-progress {
    height: 22px; border-radius: 11px;
    background: rgba(100, 116, 139, 0.15);
    overflow: hidden;
}
.app-progress .progress-bar {
    background: var(--brand-gradient);
    font-weight: 700; font-size: 0.75rem;
    transition: width 0.3s ease;
}

/* ---------- TABLE ---------- */
.app-table-wrap { max-height: 460px; overflow: auto; }
.app-table { font-size: 0.83rem; color: var(--text-main); }
.app-table thead th {
    position: sticky; top: 0; z-index: 5;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--text-muted);
    font-weight: 700; font-size: 0.72rem;
    text-transform: uppercase; letter-spacing: 0.04em;
    border-bottom: 2px solid var(--glass-border);
    white-space: nowrap;
}
.app-table tbody td {
    border-color: var(--glass-border);
    vertical-align: middle;
    max-width: 220px;
}
.app-table tbody tr { transition: background var(--transition); }
.app-table tbody tr:hover { background: rgba(37, 99, 235, 0.06); }
.cell-truncate {
    max-width: 200px; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; display: inline-block;
    vertical-align: middle;
}

/* Status badge */
.status-badge {
    font-size: 0.7rem; font-weight: 700;
    padding: 0.3em 0.65em; border-radius: 20px;
    display: inline-flex; align-items: center; gap: 0.3em;
}
.status-pending    { background: rgba(100, 116, 139, 0.15); color: #64748b; }
.status-processing { background: rgba(37, 99, 235, 0.15);   color: #2563eb; }
.status-success    { background: rgba(16, 185, 129, 0.15);  color: #10b981; }
.status-failed     { background: rgba(239, 68, 68, 0.15);   color: #ef4444; }
.status-skipped    { background: rgba(245, 158, 11, 0.15);  color: #f59e0b; }

.ext-badge {
    font-size: 0.68rem; font-weight: 700; padding: 0.25em 0.55em;
    border-radius: 6px; text-transform: uppercase;
}
.ext-docx { background: rgba(37, 99, 235, 0.15); color: #2563eb; }
.ext-doc  { background: rgba(79, 70, 229, 0.15); color: #4f46e5; }

/* Row highlight while processing */
tr.row-active { background: rgba(37, 99, 235, 0.1) !important; }

/* ---------- FOOTER ---------- */
.app-footer {
    margin-top: 2.5rem;
    padding: 1.75rem 1rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
    border-top: 1px solid var(--glass-border);
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    backdrop-filter: blur(16px) saturate(160%);
}
.btn-home {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1.75rem;
    border-radius: 14px;
    font-weight: 700;
    color: #fff;
    background: var(--brand-gradient);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
    text-decoration: none;
    transition: var(--transition);
}
.btn-home i { font-size: 1.05rem; }
.btn-home:hover {
    color: #fff;
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.55);
}
.btn-home:active { transform: translateY(-1px) scale(1); }
.footer-copy {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* ---------- LOADING OVERLAY ---------- */
.loading-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(15, 23, 42, 0.45);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    display: grid; place-items: center;
}
.loader-box {
    border-radius: 18px; padding: 2rem 2.5rem;
    display: flex; flex-direction: column; align-items: center; gap: 1rem;
}
.spinner {
    width: 52px; height: 52px; border-radius: 50%;
    border: 4px solid rgba(37, 99, 235, 0.2);
    border-top-color: var(--brand-1);
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text { font-weight: 600; color: var(--text-main); }

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.4);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: var(--brand-1); }

/* ---------- SWEETALERT theme sync ---------- */
[data-bs-theme="dark"] .swal2-popup {
    background: #172033 !important; color: #e2e8f0 !important;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
    .brand-subtitle { display: none; }
    .search-input { max-width: 120px; }
    .stat-value { font-size: 1.2rem; }
}
