/* ==========================================================================
   KitscoApp Modern Design System
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Variables
   -------------------------------------------------------------------------- */
:root {
    /* Primary Colors */
    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    --color-primary-light: #eff6ff;
    --color-primary-dark: #1d4ed8;

    /* Sidebar Colors */
    --sidebar-bg-start: #0f172a;
    --sidebar-bg-end: #1e293b;
    --sidebar-text: rgba(255, 255, 255, 0.7);
    --sidebar-text-hover: #ffffff;
    --sidebar-link-active: rgba(59, 130, 246, 0.2);
    --sidebar-border: rgba(255, 255, 255, 0.08);

    /* Status Colors */
    --color-success: #10b981;
    --color-success-light: #d1fae5;
    --color-warning: #f59e0b;
    --color-warning-light: #fef3c7;
    --color-danger: #ef4444;
    --color-danger-light: #fee2e2;
    --color-info: #06b6d4;
    --color-info-light: #cffafe;

    /* Neutral Colors */
    --color-gray-50: #f8fafc;
    --color-gray-100: #f1f5f9;
    --color-gray-200: #e2e8f0;
    --color-gray-300: #cbd5e1;
    --color-gray-400: #94a3b8;
    --color-gray-500: #64748b;
    --color-gray-600: #475569;
    --color-gray-700: #334155;
    --color-gray-800: #1e293b;
    --color-gray-900: #0f172a;

    /* Background */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Sidebar dimensions */
    --sidebar-width: 260px;
}

/* --------------------------------------------------------------------------
   Base Styles
   -------------------------------------------------------------------------- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--color-gray-700);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
.sidebar {
    min-height: 100vh;
    background: linear-gradient(180deg, var(--sidebar-bg-start) 0%, var(--sidebar-bg-end) 100%);
    width: var(--sidebar-width);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: transform var(--transition-slow);
    box-shadow: var(--shadow-lg);
}

.sidebar-brand {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-brand img {
    max-height: 32px;
    width: auto;
}

.sidebar-brand-text {
    color: #fff;
    font-weight: 600;
    font-size: 1.125rem;
    letter-spacing: -0.025em;
}

.sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin: 0.125rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all var(--transition-base);
}

.sidebar .nav-link i {
    font-size: 1.125rem;
    width: 1.25rem;
    text-align: center;
    opacity: 0.85;
}

.sidebar .nav-link:hover {
    color: var(--sidebar-text-hover);
    background: rgba(255, 255, 255, 0.08);
}

.sidebar .nav-link.active {
    color: var(--sidebar-text-hover);
    background: var(--sidebar-link-active);
}

.sidebar .nav-link.active i {
    color: var(--color-primary);
    opacity: 1;
}

.sidebar-section-label {
    color: var(--color-gray-500);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 1rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

/* --------------------------------------------------------------------------
   Main Content Area
   -------------------------------------------------------------------------- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-body);
    transition: margin-left var(--transition-slow);
}

.top-navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--color-gray-200);
    padding: 0.875rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-xs);
}

.top-navbar h5 {
    font-weight: 600;
    color: var(--color-gray-800);
    margin: 0;
    font-size: 1.125rem;
}

.content-wrapper {
    padding: 1.5rem;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-base);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--color-gray-100);
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--color-gray-800);
}

.card-header h6 {
    font-weight: 600;
    color: var(--color-gray-800);
    margin: 0;
}

.card-body {
    padding: 1.25rem;
}

/* Stat Cards */
.stat-card {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card .card-body {
    padding: 1.25rem;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    font-size: 1.25rem;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 0.25rem;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-gray-800);
    line-height: 1.2;
}

/* Icon backgrounds */
.stat-icon-primary {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.stat-icon-success {
    background: var(--color-success-light);
    color: var(--color-success);
}

.stat-icon-warning {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.stat-icon-danger {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.stat-icon-info {
    background: var(--color-info-light);
    color: var(--color-info);
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
}

.table thead th {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-gray-500);
    border-bottom: 1px solid var(--color-gray-200);
    padding: 0.875rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--color-gray-100);
    color: var(--color-gray-700);
}

.table-hover tbody tr:hover {
    background-color: var(--color-gray-50);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */
.badge {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.375rem 0.625rem;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Modern badge colors */
.badge-draft {
    background-color: var(--color-gray-100);
    color: var(--color-gray-600);
}

.badge-sent {
    background-color: var(--color-info-light);
    color: #0891b2;
}

.badge-viewed {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
}

.badge-paid {
    background-color: var(--color-success-light);
    color: #059669;
}

.badge-overdue {
    background-color: var(--color-danger-light);
    color: #dc2626;
}

.badge-cancelled {
    background-color: var(--color-gray-200);
    color: var(--color-gray-500);
}

.badge-active {
    background-color: var(--color-success-light);
    color: #059669;
}

.badge-inactive {
    background-color: var(--color-gray-100);
    color: var(--color-gray-500);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
    font-weight: 500;
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    box-shadow: var(--shadow-md);
}

.btn-dark {
    background-color: var(--color-gray-900);
    border-color: var(--color-gray-900);
}

.btn-dark:hover {
    background-color: var(--color-gray-800);
    border-color: var(--color-gray-800);
}

.btn-outline-primary {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-outline-primary:hover {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-success {
    background-color: var(--color-success);
    border-color: var(--color-success);
}

.btn-success:hover {
    background-color: #059669;
    border-color: #059669;
}

.btn-info {
    background-color: var(--color-info);
    border-color: var(--color-info);
}

.btn-info:hover {
    background-color: #0891b2;
    border-color: #0891b2;
}

.btn-danger {
    background-color: var(--color-danger);
    border-color: var(--color-danger);
}

.btn-danger:hover {
    background-color: #dc2626;
    border-color: #dc2626;
}

/* Button sizes */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* Filter button group */
.filter-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-btn {
    font-size: 0.8125rem;
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-full);
    font-weight: 500;
    transition: all var(--transition-fast);
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-gray-700);
    margin-bottom: 0.375rem;
}

.form-control,
.form-select {
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
    color: var(--color-gray-700);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control::placeholder {
    color: var(--color-gray-400);
}

.form-control-lg {
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

.form-check-input:checked {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   Alerts / Flash Messages
   -------------------------------------------------------------------------- */
.alert {
    border: none;
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-success {
    background-color: var(--color-success-light);
    color: #065f46;
}

.alert-danger {
    background-color: var(--color-danger-light);
    color: #991b1b;
}

.alert-warning {
    background-color: var(--color-warning-light);
    color: #92400e;
}

.alert-info {
    background-color: var(--color-info-light);
    color: #155e75;
}

/* --------------------------------------------------------------------------
   Empty State
   -------------------------------------------------------------------------- */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    background: var(--color-gray-100);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: var(--color-gray-400);
    font-size: 1.5rem;
}

.empty-state-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-gray-700);
    margin-bottom: 0.5rem;
}

.empty-state-text {
    font-size: 0.875rem;
    color: var(--color-gray-500);
    margin-bottom: 1.5rem;
}

/* --------------------------------------------------------------------------
   Invoice Preview
   -------------------------------------------------------------------------- */
.invoice-preview {
    background: white;
    padding: 2rem;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    max-width: 800px;
    box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   User Avatar
   -------------------------------------------------------------------------- */
.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   Login Page
   -------------------------------------------------------------------------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--sidebar-bg-start) 0%, var(--sidebar-bg-end) 100%);
}

.login-card {
    max-width: 420px;
    width: 100%;
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.login-card .card-body {
    padding: 2.5rem;
}

.login-logo {
    max-width: 200px;
    margin-bottom: 0.5rem;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-gray-800);
    margin-bottom: 0.25rem;
}

.login-subtitle {
    color: var(--color-gray-500);
    font-size: 0.9375rem;
}

/* --------------------------------------------------------------------------
   Mobile Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        backdrop-filter: blur(4px);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .content-wrapper {
        padding: 1rem;
    }
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */
@media print {
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar,
    .top-navbar {
        display: none !important;
    }

    .invoice-preview {
        border: none;
        padding: 0;
        max-width: 100%;
        box-shadow: none;
    }

    .content-wrapper {
        padding: 0;
    }
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */
.text-primary {
    color: var(--color-primary) !important;
}

.text-success {
    color: var(--color-success) !important;
}

.text-danger {
    color: var(--color-danger) !important;
}

.text-warning {
    color: var(--color-warning) !important;
}

.text-info {
    color: var(--color-info) !important;
}

.bg-primary-light {
    background-color: var(--color-primary-light) !important;
}

.bg-success-light {
    background-color: var(--color-success-light) !important;
}

.bg-danger-light {
    background-color: var(--color-danger-light) !important;
}

.bg-warning-light {
    background-color: var(--color-warning-light) !important;
}

.bg-info-light {
    background-color: var(--color-info-light) !important;
}

/* Cursor pointer for clickable rows */
.cursor-pointer {
    cursor: pointer;
}

/* Smooth transitions for interactive elements */
.transition-all {
    transition: all var(--transition-base);
}

/* Chat select mode: hide per-message hover actions while selecting */
.chat-selecting .chat-msg-actions {
    display: none !important;
}

/* Chat bubble surfaces */
.chat-bubble {
    border-radius: 1.25rem;
}

.chat-bubble-mine {
    background: linear-gradient(135deg, #3b74cf 0%, #16407e 100%);
    border-bottom-right-radius: 0.25rem;
    box-shadow: 0 3px 10px rgba(22, 64, 126, 0.35);
}

.chat-bubble-theirs {
    background: #ffffff;
    border-bottom-left-radius: 0.25rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 3px 8px rgba(15, 23, 42, 0.06);
}

/* Deleted messages render as a quiet ghost instead of a full bubble */
.chat-bubble-deleted {
    background: rgba(148, 163, 184, 0.12);
    border: 1px dashed rgba(100, 116, 139, 0.35);
    box-shadow: none;
}

/* Bubble color themes for own messages, scoped to the thread container.
   .chat-bt-<key> themes the bubbles; .chat-bts-<key> styles the picker swatch. */
.chat-bt-emerald .chat-bubble-mine, .chat-bts-emerald {
    background: linear-gradient(135deg, #2fb380 0%, #0e6b4a 100%);
    box-shadow: 0 3px 10px rgba(14, 107, 74, 0.35);
}

.chat-bt-violet .chat-bubble-mine, .chat-bts-violet {
    background: linear-gradient(135deg, #9d6ff5 0%, #5b21b6 100%);
    box-shadow: 0 3px 10px rgba(91, 33, 182, 0.35);
}

.chat-bt-rose .chat-bubble-mine, .chat-bts-rose {
    background: linear-gradient(135deg, #f5647c 0%, #9f1239 100%);
    box-shadow: 0 3px 10px rgba(159, 18, 57, 0.35);
}

.chat-bt-amber .chat-bubble-mine, .chat-bts-amber {
    background: linear-gradient(135deg, #f5a623 0%, #b45309 100%);
    box-shadow: 0 3px 10px rgba(180, 83, 9, 0.35);
}

.chat-bt-slate .chat-bubble-mine, .chat-bts-slate {
    background: linear-gradient(135deg, #7b8aa0 0%, #1e293b 100%);
    box-shadow: 0 3px 10px rgba(30, 41, 59, 0.35);
}

/* Soft tinted thread backdrop so the white bubbles pop */
.chat-thread-bg {
    background: linear-gradient(180deg, #f2f5fa 0%, #e8edf5 100%);
}

/* Wallpaper presets — keys must match ChatService::WALLPAPER_PRESETS */
.chat-wp-doodle {
    background-color: #edf1f7;
    background-image: url("data:image/svg+xml,%3Csvg width='56' height='56' viewBox='0 0 56 56' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23c9d4e5' stroke-width='1.4' opacity='.6'%3E%3Ccircle cx='10' cy='10' r='3'/%3E%3Cpath d='M38 12h10M43 7v10'/%3E%3Ccircle cx='30' cy='34' r='2'/%3E%3Cpath d='M8 40l6 6M14 40l-6 6'/%3E%3Ccircle cx='46' cy='44' r='3.5'/%3E%3C/g%3E%3C/svg%3E");
}

.chat-wp-ocean {
    background: linear-gradient(180deg, #d7e9fb 0%, #b7d4f0 100%);
}

.chat-wp-sunset {
    background: linear-gradient(180deg, #ffe8d6 0%, #f8c8b4 100%);
}

.chat-wp-forest {
    background: linear-gradient(180deg, #dcefdd 0%, #bcdcc4 100%);
}

.chat-wp-lavender {
    background: linear-gradient(180deg, #eae4f8 0%, #d2c6ec 100%);
}

.chat-wp-midnight {
    background: linear-gradient(180deg, #26334a 0%, #131c2e 100%);
}

.chat-wp-dots {
    background-color: #f7f3ec;
    background-image: url("data:image/svg+xml,%3Csvg width='28' height='28' viewBox='0 0 28 28' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23d9cfbf'%3E%3Ccircle cx='7' cy='7' r='2'/%3E%3Ccircle cx='21' cy='21' r='2'/%3E%3C/g%3E%3C/svg%3E");
}

.chat-wp-waves {
    background-color: #e7f0f7;
    background-image: url("data:image/svg+xml,%3Csvg width='48' height='28' viewBox='0 0 48 28' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 14 q6 -7 12 0 t12 0 t12 0 t12 0' fill='none' stroke='%23b9d2e5' stroke-width='1.5'/%3E%3C/svg%3E");
}

.chat-wp-leaves {
    background-color: #eaf3e7;
    background-image: url("data:image/svg+xml,%3Csvg width='44' height='44' viewBox='0 0 44 44' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23b9d6b2' stroke-width='1.3'%3E%3Cpath d='M8 20 q0 -10 10 -10 q0 10 -10 10z'/%3E%3Cpath d='M13 15 L8 20'/%3E%3Cpath d='M36 38 q0 -8 -8 -8 q0 8 8 8z'/%3E%3Cpath d='M32 34 L36 38'/%3E%3C/g%3E%3C/svg%3E");
}

.chat-wp-diamonds {
    background-color: #f1eff5;
    background-image: url("data:image/svg+xml,%3Csvg width='26' height='26' viewBox='0 0 26 26' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 3 L23 13 L13 23 L3 13z' fill='none' stroke='%23d4cfe2' stroke-width='1.2'/%3E%3C/svg%3E");
}

.chat-wp-bubbles {
    background-color: #e4f1f4;
    background-image: url("data:image/svg+xml,%3Csvg width='56' height='56' viewBox='0 0 56 56' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23b5d8de' stroke-width='1.3'%3E%3Ccircle cx='12' cy='14' r='6'/%3E%3Ccircle cx='40' cy='8' r='3'/%3E%3Ccircle cx='46' cy='38' r='7'/%3E%3Ccircle cx='20' cy='44' r='4'/%3E%3C/g%3E%3C/svg%3E");
}

.chat-wp-stars {
    background-color: #1c2540;
    background-image: url("data:image/svg+xml,%3Csvg width='52' height='52' viewBox='0 0 52 52' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%233d4f80'%3E%3Cpath d='M13 6 l1.2 3.3 3.3 1.2 -3.3 1.2 -1.2 3.3 -1.2 -3.3 -3.3 -1.2 3.3 -1.2z'/%3E%3Cpath d='M40 28 l1 2.7 2.7 1 -2.7 1 -1 2.7 -1 -2.7 -2.7 -1 2.7 -1z'/%3E%3Ccircle cx='30' cy='10' r='1.2'/%3E%3Ccircle cx='9' cy='40' r='1.5'/%3E%3Ccircle cx='47' cy='46' r='1'/%3E%3C/g%3E%3C/svg%3E");
}

/* Uploaded wallpaper image (URL is set inline on the container) */
.chat-wp-image {
    background-size: cover;
    background-position: center;
}

/* Chat bubble + reaction animations (applied to freshly streamed-in nodes) */
@keyframes chat-bubble-in {
    from { opacity: 0; transform: translateY(10px) scale(0.92); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.chat-bubble-in {
    animation: chat-bubble-in 0.18s ease-out;
}

@keyframes chat-chip-pop {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}
.chat-reaction-chip {
    animation: chat-chip-pop 0.15s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .chat-bubble-in,
    .chat-reaction-chip {
        animation: none;
    }
}

/* Telegram-style albums: consecutive image-only messages from the same
   sender are wrapped by chat_thread_controller into a tiling grid */
.chat-album {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
    width: 75%;
    max-width: 22rem;
}

.chat-album-mine {
    margin-left: auto;
}

/* Odd count: lead image gets a full-width panoramic tile */
.chat-album-odd > .chat-album-item:first-child {
    grid-column: span 2;
}

.chat-album > .chat-album-item {
    padding: 0;
}

.chat-album-item > div {
    max-width: none;
    width: 100%;
}

.chat-album-item .chat-bubble {
    padding: 0;
    border-radius: 0.65rem;
    overflow: hidden;
    height: 100%;
}

.chat-album-item .chat-bubble a[data-lightbox-image] {
    display: block;
    margin: 0;
    aspect-ratio: 1 / 1;
}

.chat-album-odd > .chat-album-item:first-child .chat-bubble a[data-lightbox-image] {
    aspect-ratio: 2 / 1;
}

.chat-album-item .chat-bubble img {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    border-radius: 0;
}

/* One timestamp per album, overlaid on the last tile */
.chat-album-item .chat-msg-time {
    display: none;
}

.chat-album-item:last-child .chat-msg-time {
    display: block;
    position: absolute;
    right: 0.4rem;
    bottom: 0.4rem;
    margin: 0;
    padding: 0.1rem 0.5rem;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.55);
    color: rgba(255, 255, 255, 0.92);
    z-index: 1;
}

/* Group-chat sender name as a chip on the first tile */
.chat-album-item .chat-msg-sender {
    display: none;
}

.chat-album-item:first-child .chat-msg-sender {
    display: block;
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    margin: 0;
    padding: 0.1rem 0.5rem;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.55);
    color: #fff;
    z-index: 1;
}

/* Reactions float over the tile instead of pushing the grid row taller */
.chat-album-item .chat-msg-reactions {
    position: absolute;
    left: 0.4rem;
    bottom: 0.4rem;
    margin: 0;
    z-index: 1;
}

/* Group-chat sender avatars are per-bubble; inside an album the name chip
   on the first tile already identifies the sender */
.chat-album-item .chat-msg-avatar {
    display: none;
}

/* Hover actions sit inside the tile: beside-the-bubble placement would
   overlap the neighbouring column */
.chat-album-item .chat-msg-actions {
    top: 0.35rem;
    right: 0.35rem;
    left: auto;
    margin: 0;
    transform: none;
    z-index: 2;
}

/* Slim, fade-in scrollbar for the main sidebar */
#sidebar .overflow-y-auto {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

#sidebar .overflow-y-auto::-webkit-scrollbar {
    width: 6px;
}

#sidebar .overflow-y-auto::-webkit-scrollbar-track {
    background: transparent;
}

#sidebar .overflow-y-auto::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 9999px;
}

#sidebar .overflow-y-auto:hover::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
}

/* SweetAlert-style confirm dialog animations */
@keyframes confirm-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes confirm-backdrop-out {
    from { opacity: 1; }
    to { opacity: 0; }
}
@keyframes confirm-card-pop {
    0% { transform: scale(0.7); opacity: 0; }
    45% { transform: scale(1.05); opacity: 1; }
    80% { transform: scale(0.97); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes confirm-card-out {
    from { transform: scale(1); opacity: 1; }
    to { transform: scale(0.6); opacity: 0; }
}
.confirm-backdrop-in { animation: confirm-backdrop-in 0.15s ease-out; }
.confirm-backdrop-out { animation: confirm-backdrop-out 0.15s ease-in forwards; }
.confirm-card-pop { animation: confirm-card-pop 0.3s ease-out; }
.confirm-card-out { animation: confirm-card-out 0.15s ease-in forwards; }

@media (prefers-reduced-motion: reduce) {
    .confirm-backdrop-in,
    .confirm-backdrop-out,
    .confirm-card-pop,
    .confirm-card-out {
        animation: none;
    }
}
