/* Premium UI layer on top of Bootstrap 5. */

:root {
    --bg: #07111f;
    --bg-soft: #0f172a;
    --surface: rgba(255, 255, 255, 0.82);
    --surface-strong: #ffffff;
    --surface-muted: rgba(255, 255, 255, 0.64);
    --border: rgba(148, 163, 184, 0.20);
    --border-strong: rgba(148, 163, 184, 0.34);
    --text: #0f172a;
    --muted: #64748b;
    --accent: #ef4444;
    --accent-dark: #dc2626;
    --accent-glow: rgba(239, 68, 68, 0.28);
    --primary-glow: rgba(59, 130, 246, 0.20);
    --success-glow: rgba(34, 197, 94, 0.18);
    --shadow-lg: 0 22px 60px rgba(15, 23, 42, 0.18);
    --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.10);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
}

html, body {
    min-height: 100%;
}

body,
button,
input,
select,
textarea {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.14), transparent 28%),
        radial-gradient(circle at top right, rgba(239, 68, 68, 0.10), transparent 32%),
        linear-gradient(180deg, #f8fafc 0%, #eef2f7 55%, #f8fafc 100%);
    color: var(--text);
}

.app-shell::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 20%);
}

.app-content {
    position: relative;
    z-index: 1;
}

.text-bg-purple {
    color: #fff;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
}

.card,
.table,
.kanban-column,
.ticket-description,
.premium-filter-card,
.premium-hero,
.hero-stat-card,
.auth-card {
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.form-control,
.form-select {
    border-radius: 14px;
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: none;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(239, 68, 68, 0.45);
    box-shadow: 0 0 0 0.25rem rgba(239, 68, 68, 0.12);
}

.btn {
    border-radius: 999px;
    font-weight: 600;
}

.premium-btn {
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    box-shadow: 0 14px 30px var(--accent-glow);
}

.premium-btn:hover,
.premium-btn:focus {
    background: linear-gradient(135deg, #f87171, #dc2626);
    transform: translateY(-1px);
}

.premium-outline-btn {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.06);
}

.premium-outline-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.45);
}

/* Navbar */
.app-navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background:
        linear-gradient(135deg, rgba(7, 17, 31, 0.96), rgba(15, 23, 42, 0.92)),
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.20), transparent 24%);
    box-shadow: 0 18px 40px rgba(2, 6, 23, 0.24);
}

.app-navbar .nav-link {
    color: rgba(255, 255, 255, 0.76);
    font-weight: 500;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus {
    color: #fff;
}

.brand-mark,
.premium-logo {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #ef4444, #7c3aed);
    box-shadow: 0 14px 32px rgba(124, 58, 237, 0.30);
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    font-size: 1rem;
}

.premium-logo {
    font-size: 1.2rem;
}

.nav-divider {
    display: inline-block;
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.14);
}

.role-pill {
    border: 1px solid rgba(255, 255, 255, 0.20);
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
    padding: 0.55rem 0.8rem;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.8rem;
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.86);
    background: rgba(255, 255, 255, 0.08);
}

/* Auth */
.auth-wrapper {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow: hidden;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.18), transparent 30%),
        radial-gradient(circle at bottom right, rgba(239, 68, 68, 0.16), transparent 32%),
        linear-gradient(135deg, #020617, #0f172a 52%, #131c31);
}

.auth-glow {
    position: absolute;
    border-radius: 999px;
    filter: blur(12px);
    opacity: 0.7;
}

.auth-glow-1 {
    width: 280px;
    height: 280px;
    left: 10%;
    top: 8%;
    background: rgba(59, 130, 246, 0.22);
}

.auth-glow-2 {
    width: 320px;
    height: 320px;
    right: 8%;
    bottom: 5%;
    background: rgba(239, 68, 68, 0.20);
}

.auth-card {
    width: 100%;
    max-width: 430px;
    position: relative;
    z-index: 1;
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--shadow-lg);
}

.auth-card .card-body {
    padding: 2.2rem !important;
}

/* Hero */
.premium-hero {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.48);
    border-radius: 28px;
    padding: 1.4rem;
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.14), transparent 24%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.90), rgba(255, 255, 255, 0.72));
    box-shadow: var(--shadow-lg);
}

.premium-hero::after {
    content: '';
    position: absolute;
    inset: auto -10% -55% auto;
    width: 320px;
    height: 320px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.12), transparent 65%);
}

.hero-eyebrow,
.section-kicker {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.72rem;
    font-weight: 700;
    color: #7c3aed;
    margin-bottom: 0.35rem;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}

.hero-stat-card {
    border: 1px solid rgba(255, 255, 255, 0.56);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.72);
    padding: 1rem 1.05rem;
    box-shadow: var(--shadow-md);
}

.hero-stat-card strong {
    display: block;
    font-size: 1.55rem;
    margin-top: 0.2rem;
}

.hero-stat-label {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.section-title-wrap h2 {
    font-weight: 700;
}

.premium-filter-card {
    margin-left: 0;
    margin-right: 0;
    padding: 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.74);
    box-shadow: var(--shadow-md);
}

/* Kanban */
.kanban-board {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.kanban-column {
    flex: 0 0 320px;
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 220px);
    box-shadow: var(--shadow-md);
}

.kanban-column-header {
    padding: 0.95rem 1rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kanban-column-body {
    padding: 0.75rem;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 80px;
}

.kanban-card {
    background: rgba(255, 255, 255, 0.94);
    border-radius: 18px;
    padding: 0.9rem;
    margin-bottom: 0.7rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    cursor: grab;
    text-decoration: none;
    color: inherit;
    display: block;
    border: 1px solid rgba(226, 232, 240, 0.92);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
    border-color: rgba(239, 68, 68, 0.18);
    color: inherit;
}

.kanban-card.dragging {
    opacity: 0.45;
}

.kanban-column-body.drag-over {
    background: rgba(219, 234, 254, 0.56);
    border-radius: 14px;
}

.control-number,
.kanban-card .control-number {
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 0.76rem;
    color: #64748b;
}

/* Rich text */
#descriptionEditor {
    min-height: 220px;
    background: rgba(255, 255, 255, 0.94);
    border-radius: 0 0 16px 16px;
}

.ql-toolbar.ql-snow,
.ql-container.ql-snow {
    border-color: rgba(148, 163, 184, 0.20) !important;
}

.ql-toolbar.ql-snow {
    border-radius: 16px 16px 0 0;
    background: rgba(255, 255, 255, 0.88);
}

.ql-container.ql-snow {
    border-radius: 0 0 16px 16px;
}

/* Tables & detail cards */
.table-responsive > .table,
.card,
.ticket-description {
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: 20px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: var(--shadow-md);
}

.table > :not(caption) > * > * {
    border-bottom-color: rgba(148, 163, 184, 0.12);
}

.ticket-description {
    padding: 1.1rem 1.15rem;
}

.ticket-description p:last-child {
    margin-bottom: 0;
}

.attachment-thumb {
    width: 100%;
    height: 130px;
    object-fit: cover;
    border-radius: 14px;
    background: #020617;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
}

.alert {
    border: none;
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

@media (max-width: 991.98px) {
    .hero-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kanban-column {
        flex-basis: 290px;
    }
}

@media (max-width: 575.98px) {
    .auth-wrapper {
        padding: 1rem;
    }

    .auth-card .card-body {
        padding: 1.5rem !important;
    }

    .premium-hero {
        padding: 1rem;
        border-radius: 22px;
    }

    .hero-stats {
        grid-template-columns: 1fr;
    }

    .premium-filter-card {
        padding: 0.8rem;
    }
}

/* ===== Facebook-style comments ===== */
.fb-comments { margin-bottom: 0; }
.fb-comment { display: flex; gap: 0.6rem; margin-bottom: 1rem; }
.fb-comment-avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 0.78rem; font-weight: 700; flex-shrink: 0; line-height: 1; }
.fb-comment-body { flex: 1; min-width: 0; }
.fb-comment-bubble { background: #f0f2f5; border-radius: 18px; padding: 0.55rem 0.85rem; display: inline-block; max-width: 100%; }
.fb-comment-author { font-size: 0.8rem; font-weight: 700; color: #1c1e21; margin-bottom: 0.15rem; }
.fb-comment-text { font-size: 0.875rem; color: #1c1e21; line-height: 1.4; word-break: break-word; }
.fb-comment-meta { padding-left: 0.85rem; margin-top: 0.15rem; font-size: 0.72rem; color: #65676b; }
.fb-comment-attachments { margin-top: 0.5rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.fb-comment-img { max-width: 200px; max-height: 200px; border-radius: 12px; object-fit: cover; border: 1px solid rgba(0,0,0,0.08); cursor: pointer; transition: transform 0.15s ease; }
.fb-comment-img:hover { transform: scale(1.03); }
.fb-comment-video-wrap { max-width: 280px; }
.fb-comment-video { width: 100%; max-height: 200px; border-radius: 12px; border: 1px solid rgba(0,0,0,0.08); }
.fb-comment-form { display: flex; gap: 0.6rem; align-items: flex-start; margin-top: 1rem; padding-top: 0.8rem; border-top: 1px solid rgba(148,163,184,0.16); }
.fb-comment-input-wrap { flex: 1; min-width: 0; }
.fb-comment-textarea { border-radius: 20px !important; padding: 0.55rem 1rem !important; font-size: 0.875rem !important; resize: none; overflow: hidden; min-height: 38px; background: #f0f2f5 !important; border: 1.5px solid #ccd0d5 !important; }
.fb-comment-textarea:focus { background: #fff !important; box-shadow: 0 0 0 2px rgba(239,68,68,0.25) !important; }
.fb-comment-actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.4rem; }
.fb-attach-btn { cursor: pointer; color: #65676b; font-size: 1.1rem; padding: 0.25rem 0.5rem; border-radius: 50%; transition: background 0.15s; display: flex; align-items: center; }
.fb-attach-btn:hover { background: #e4e6eb; color: #1c1e21; }
.fb-attach-preview { display: flex; flex-wrap: wrap; gap: 0.25rem; font-size: 0.72rem; }
