/* assets/css/style.css - Conectados Mail Brand Design */
:root {
    /* Conectados Brand Colors */
    --primary-color: #6943E1;    /* Violet - Primary accent */
    --primary-hover: #5632C8;    /* Darker violet */
    --secondary-color: #28A0B3;  /* Teal - Secondary */
    --secondary-hover: #1F8A9B;  /* Darker teal */
    --dark-color: #242543;       /* Deep navy - Main dark */
    --deep-purple: #2D1942;      /* Deep purple - Gradients */
    --accent-teal: #66B2B1;      /* Light teal - Accents */
    --light-bg: #f0f2f7;
    --text-primary: #242543;
    --text-muted: #6B7280;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.25);
    --skeleton-base: #e2e5ea;
    --skeleton-highlight: #f5f6f8;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--light-bg);
    color: var(--text-primary);
}

/* ============================================= */
/* MODAL GLASS EFFECT - APPLE STYLE             */
/* ============================================= */

#composeModal+.modal-backdrop,
.modal-backdrop.show {
    background-color: rgba(36, 37, 67, 0.25) !important;
}

#composeModal .modal-content {
    background: rgba(255, 255, 255, 0.75) !important;
    backdrop-filter: blur(40px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(40px) saturate(180%) !important;
    box-shadow:
        0 25px 50px -12px rgba(36, 37, 67, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset,
        0 1px 0 0 rgba(255, 255, 255, 0.4) inset !important;
    border-radius: 16px !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

#composeModal .modal-header {
    background: rgba(255, 255, 255, 0.40) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.4) !important;
    border-radius: 16px 16px 0 0 !important;
}

#composeModal .modal-body {
    background: rgba(255, 255, 255, 0.25) !important;
}

#composeModal .modal-footer {
    background: rgba(255, 255, 255, 0.40) !important;
    border-radius: 0 0 16px 16px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.3) !important;
}

#composeModal .form-control {
    background: rgba(255, 255, 255, 0.5) !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
}

#composeModal .form-control:focus {
    background: rgba(255, 255, 255, 0.7) !important;
    box-shadow: 0 0 0 3px rgba(105, 67, 225, 0.15) !important;
}

/* Force override of Bootstrap Primary */
.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%) !important;
    border: none !important;
    box-shadow: 0 4px 14px rgba(105, 67, 225, 0.3) !important;
    transition: all 0.3s ease !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--secondary-hover) 100%) !important;
    border: none !important;
    box-shadow: 0 6px 20px rgba(105, 67, 225, 0.45) !important;
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color) !important;
    color: white !important;
}

/* Badge override */
.bg-danger {
    background: linear-gradient(135deg, #E94560 0%, #C62828 100%) !important;
}

/* Sidebar Branding - Deep Navy + Purple Gradient */
.sidebar {
    background: linear-gradient(180deg, var(--dark-color) 0%, var(--deep-purple) 100%) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

#mainSidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--dark-color) 0%, var(--deep-purple) 50%, #1a1038 100%);
    box-shadow: 4px 0 25px rgba(36, 37, 67, 0.4);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.7) !important;
    font-weight: 500;
    margin-bottom: 4px;
    border-radius: 10px;
    padding: 10px 15px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white !important;
    transform: translateX(4px);
}

.sidebar .nav-link.active {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%) !important;
    color: white !important;
    box-shadow: 0 4px 18px rgba(105, 67, 225, 0.45) !important;
    font-weight: 600;
}

/* Glassmorphism for Login */
.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(36, 37, 67, 0.37);
}

.glass-card {
    background: rgba(36, 37, 67, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 3rem;
    color: white;
}

/* Utilities */
.avatar-circle {
    width: 40px;
    height: 40px;
    object-fit: cover;
}

.email-item {
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.email-item:hover {
    background-color: rgba(105, 67, 225, 0.04);
    border-left-color: var(--primary-color);
}

.email-item.unread {
    background-color: #ffffff;
    border-left-color: var(--primary-color);
}

.email-item.active {
    background-color: rgba(105, 67, 225, 0.08);
    border-left-color: var(--primary-color);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: rgba(105, 67, 225, 0.15);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(105, 67, 225, 0.3);
}

/* Global Box Sizing Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Global Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
}

.main-content {
    flex: 1;
    padding: 2rem;
    width: 100%;
}

.sidebar {
    background: linear-gradient(180deg, var(--dark-color) 0%, var(--deep-purple) 100%) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    width: 250px;
    flex-shrink: 0;
}

/* Fix for responsive images globally */
img,
svg,
video {
    max-width: 100%;
    height: auto;
}

/* RESPONSIVE DESIGN */
@media (min-width: 768px) {
    #mainSidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        max-height: 100vh;
        overflow-y: auto;
        display: flex !important;
        flex-direction: column;
        width: 260px !important;
        min-width: 260px !important;
    }
}

@media (max-width: 767.98px) {
    #mainSidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
        z-index: 2000;
        transition: transform 0.3s ease-in-out;
        box-shadow: none;
    }

    #email-view-container {
        flex-direction: column;
    }

    .col-md-4.col-lg-3,
    .col-md-8.col-lg-9 {
        width: 100% !important;
        flex: none !important;
        height: auto !important;
    }

    .col-md-4.col-lg-3 {
        border-right: none !important;
        border-bottom: 1px solid #dee2e6;
        margin-bottom: 1rem;
    }

    .col-md-8.col-lg-9 {
        height: auto !important;
    }

    .main-content {
        padding: 1rem;
    }
}

.avatar-circle {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Skeleton Loading Animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-highlight) 50%, var(--skeleton-base) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    display: inline-block;
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
    width: 100%;
}

.skeleton-heading {
    height: 1.5em;
    width: 80%;
    margin-bottom: 1em;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

/* Glass effect helpers */
.glass {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Toast Container Position */
.toast-container {
    z-index: 1060;
}

/* Tag Input Styles */
.recipient-tag {
    background-color: rgba(105, 67, 225, 0.08);
    color: var(--dark-color);
    border-radius: 16px;
    padding: 2px 10px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    border: 1px solid rgba(105, 67, 225, 0.2);
}

.recipient-tag .tag-remove {
    margin-left: 6px;
    cursor: pointer;
    font-weight: bold;
    color: #6c757d;
    font-size: 1.1em;
    line-height: 0.8;
}

.recipient-tag .tag-remove:hover {
    color: var(--primary-color);
}

.recipient-tag.invalid {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Attachments Section Styles */
.attachments-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.attachments-section .btn-outline-secondary {
    background: white;
    border-color: #dee2e6;
    transition: all 0.2s ease;
}

.attachments-section .btn-outline-secondary:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(105, 67, 225, 0.25);
}

.attachments-section .btn-outline-secondary:hover i,
.attachments-section .btn-outline-secondary:hover span {
    color: white !important;
}

/* File type icon colors */
.text-purple {
    color: var(--primary-color) !important;
}

/* Email content images responsive */
.email-content-block img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Email content block styling */
.email-content-block {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.email-content-block table {
    max-width: 100%;
    overflow-x: auto;
    display: block;
}

.email-content-block img[src^="data:"] {
    max-width: 100%;
    border-radius: 4px;
    margin: 0.5rem 0;
}

.badge.bg-secondary.rounded-pill {
    font-size: 0.7rem;
    font-weight: 500;
}

/* ============================================= */
/* QUILL EDITOR STYLES - PREMIUM UI             */
/* ============================================= */

#quill-toolbar,
.ql-toolbar.ql-snow {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.98) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    border-radius: 12px 12px 0 0;
    padding: 10px 14px !important;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.ql-toolbar .ql-formats {
    display: inline-flex !important;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    margin-right: 6px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.ql-toolbar .ql-formats:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.ql-toolbar button,
.ql-toolbar .ql-picker-label {
    width: 32px !important;
    height: 32px !important;
    padding: 6px !important;
    border-radius: 6px !important;
    border: none !important;
    background: transparent !important;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.ql-toolbar button:hover,
.ql-toolbar .ql-picker-label:hover {
    background: rgba(105, 67, 225, 0.1) !important;
    transform: scale(1.08);
}

.ql-toolbar button.ql-active,
.ql-toolbar .ql-picker-label.ql-active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%) !important;
    border-radius: 6px !important;
    box-shadow: 0 3px 12px rgba(105, 67, 225, 0.35) !important;
    transform: scale(1.02);
}

.ql-toolbar button.ql-active .ql-stroke,
.ql-toolbar button.ql-active .ql-fill,
.ql-toolbar .ql-picker-label.ql-active .ql-stroke {
    stroke: white !important;
    fill: white !important;
}

.ql-toolbar .ql-stroke {
    stroke: #495057 !important;
    stroke-width: 1.8 !important;
    transition: all 0.15s ease !important;
}

.ql-toolbar .ql-fill {
    fill: #495057 !important;
    transition: all 0.15s ease !important;
}

.ql-toolbar button:hover .ql-stroke,
.ql-toolbar .ql-picker-label:hover .ql-stroke {
    stroke: var(--primary-color) !important;
}

.ql-toolbar button:hover .ql-fill,
.ql-toolbar .ql-picker-label:hover .ql-fill {
    fill: var(--primary-color) !important;
}

.ql-toolbar .ql-picker {
    height: 32px !important;
}

.ql-toolbar .ql-picker-options {
    background: white !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
    padding: 6px !important;
}

.ql-toolbar .ql-picker-item {
    border-radius: 4px !important;
    padding: 4px 8px !important;
    transition: background 0.15s ease !important;
}

.ql-toolbar .ql-picker-item:hover {
    background: rgba(105, 67, 225, 0.08) !important;
    color: var(--primary-color) !important;
}

#quill-editor {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-top: none;
    border-radius: 0 0 12px 12px;
    transition: box-shadow 0.2s ease;
}

#quill-editor:focus-within {
    box-shadow: 0 0 0 3px rgba(105, 67, 225, 0.15);
}

.ql-container.ql-snow {
    border-color: rgba(0, 0, 0, 0.08) !important;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
}

.ql-editor {
    padding: 16px 20px !important;
    line-height: 1.6;
}

.ql-editor.ql-blank::before {
    color: #adb5bd;
    font-style: normal;
}

/* Custom toolbar buttons */
.ql-emoji,
.ql-template {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 32px !important;
    height: 32px !important;
    border-radius: 6px !important;
    transition: all 0.15s ease !important;
}

.ql-emoji i,
.ql-template i {
    font-size: 1rem;
    color: #495057;
    transition: all 0.15s ease;
}

.ql-emoji:hover,
.ql-template:hover {
    background: rgba(105, 67, 225, 0.1) !important;
    transform: scale(1.08);
}

.ql-emoji:hover i,
.ql-template:hover i {
    color: var(--primary-color);
}

/* Emoji picker container */
#emoji-picker-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

#emoji-grid button {
    border: none !important;
    border-radius: 6px;
    transition: all 0.12s ease;
}

#emoji-grid button:hover {
    transform: scale(1.25);
    background-color: rgba(105, 67, 225, 0.1) !important;
}

/* Template cards hover effect */
.template-card {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
    border-radius: 12px;
}

.template-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.18) !important;
}

/* Quill editor image sizing */
.ql-editor img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Links in sent emails */
.email-content-block a {
    color: var(--primary-color);
    text-decoration: underline;
    transition: color 0.15s ease;
}

.email-content-block a:hover {
    color: var(--secondary-color);
}

/* ============================================= */
/* MOBILE OPTIMIZATION - FLOATING MENU          */
/* ============================================= */

@media (max-width: 767.98px) {

    /* ===== HIDE DESKTOP SIDEBAR ===== */
    #mainSidebar,
    #pageSidebar {
        display: none !important;
    }

    /* ===== FLOATING MENU GLASS ===== */
    .mobile-menu-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 3000;
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .mobile-menu-container.show {
        opacity: 1;
        visibility: visible;
    }

    .mobile-menu-backdrop {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(36, 37, 67, 0.5);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    .mobile-menu {
        position: relative;
        width: 90%;
        max-width: 300px;
        max-height: 85vh;
        overflow-y: auto;
        background: rgba(36, 37, 67, 0.92);
        backdrop-filter: blur(40px) saturate(180%);
        -webkit-backdrop-filter: blur(40px) saturate(180%);
        border-radius: 20px;
        padding: 20px;
        box-shadow:
            0 25px 60px rgba(36, 37, 67, 0.5),
            0 0 0 1px rgba(255, 255, 255, 0.08) inset,
            0 1px 0 0 rgba(255, 255, 255, 0.1) inset;
        border: 1px solid rgba(255, 255, 255, 0.08);
        transform: scale(0.9) translateY(20px);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .mobile-menu-container.show .mobile-menu {
        transform: scale(1) translateY(0);
    }

    .mobile-menu-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 20px;
        padding-bottom: 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .mobile-menu-logo {
        display: flex;
        align-items: center;
        gap: 10px;
        color: white;
        font-weight: 600;
        font-size: 1.1rem;
    }

    .mobile-menu-logo i {
        color: var(--accent-teal);
    }

    .mobile-menu-close {
        width: 36px;
        height: 36px;
        border: none;
        background: rgba(255, 255, 255, 0.1);
        color: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .mobile-menu-close:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: rotate(90deg);
    }

    .mobile-menu-nav {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .mobile-menu-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 11px 14px;
        color: rgba(255, 255, 255, 0.85);
        text-decoration: none;
        border-radius: 10px;
        font-weight: 500;
        font-size: 0.95rem;
        transition: all 0.2s ease;
        background: transparent;
        border: none;
        width: 100%;
        text-align: left;
        cursor: pointer;
    }

    .mobile-menu-item:hover,
    .mobile-menu-item.active {
        background: rgba(255, 255, 255, 0.1);
        color: white;
    }

    .mobile-menu-item.active {
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
        box-shadow: 0 4px 15px rgba(105, 67, 225, 0.4);
    }

    .mobile-menu-item i {
        width: 20px;
        text-align: center;
        font-size: 1.1rem;
    }

    .mobile-menu-divider {
        height: 1px;
        background: rgba(255, 255, 255, 0.08);
        margin: 12px 0;
    }

    .mobile-menu-compose {
        margin-top: 16px;
        padding: 14px;
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
        color: white;
        border: none;
        border-radius: 12px;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        cursor: pointer;
        transition: all 0.2s ease;
        box-shadow: 0 4px 15px rgba(105, 67, 225, 0.35);
    }

    .mobile-menu-compose:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(105, 67, 225, 0.45);
    }

    /* Hamburger button floating */
    .toggle-sidebar-btn {
        display: flex !important;
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 2500;
        width: 48px;
        height: 48px;
        align-items: center;
        justify-content: center;
        background: rgba(36, 37, 67, 0.7);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        color: white;
        border-radius: 14px;
        box-shadow: 0 4px 20px rgba(36, 37, 67, 0.3);
        border: 1px solid rgba(255, 255, 255, 0.1);
        transition: all 0.2s ease;
    }

    .toggle-sidebar-btn:hover {
        background: rgba(36, 37, 67, 0.9);
        transform: scale(1.05);
    }

    /* ===== MAIN CONTENT LAYOUT ===== */
    .main-content {
        padding: 60px 10px 10px 10px !important;
        margin-left: 0 !important;
    }

    /* Email view container - stack columns */
    #email-view-container,
    .row.flex-grow-1 {
        flex-direction: column !important;
    }

    /* Email list column - FULL SCREEN on mobile */
    .col-md-4.col-lg-3,
    [class*="col-md-4"][class*="col-lg-3"] {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        border-right: none !important;
        border-bottom: none !important;
        max-height: calc(100vh - 70px);
        min-height: calc(100vh - 70px);
        overflow-y: auto;
    }

    /* Email detail column - OVERLAY on mobile */
    .col-md-8.col-lg-9,
    [class*="col-md-8"][class*="col-lg-9"] {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh !important;
        max-height: 100vh !important;
        background: white;
        z-index: 1500;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        padding-top: 50px !important;
    }

    .col-md-8.col-lg-9.show-mobile,
    [class*="col-md-8"][class*="col-lg-9"].show-mobile {
        transform: translateX(0);
    }

    /* Close button for mobile detail view */
    .mobile-back-btn {
        position: fixed;
        top: 12px;
        right: 12px;
        left: auto;
        z-index: 2000;
        width: 40px;
        height: 40px;
        background: rgba(0, 0, 0, 0.1);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        color: #333;
        border: 1px solid rgba(0, 0, 0, 0.1);
        border-radius: 50%;
        display: none;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .mobile-back-btn:active {
        background: rgba(0, 0, 0, 0.2);
        transform: scale(0.95);
    }

    .mobile-back-btn.show {
        display: flex;
    }

    /* ===== MODAL RESPONSIVE ===== */
    .modal-dialog {
        margin: 10px !important;
        max-width: calc(100vw - 20px) !important;
    }

    .modal-lg,
    .modal-xl {
        max-width: calc(100vw - 20px) !important;
    }

    #composeModal .modal-content {
        border-radius: 12px !important;
    }

    #composeModal .modal-body {
        padding: 12px !important;
    }

    /* Quill toolbar compact on mobile */
    #quill-toolbar,
    .ql-toolbar.ql-snow {
        padding: 6px !important;
        gap: 3px !important;
        flex-wrap: wrap !important;
    }

    .ql-toolbar .ql-formats {
        padding: 2px 4px !important;
        margin-right: 3px !important;
        margin-bottom: 3px !important;
    }

    .ql-toolbar button,
    .ql-toolbar .ql-picker-label {
        width: 28px !important;
        height: 28px !important;
        padding: 4px !important;
    }

    /* Modal footer - stack buttons */
    #composeModal .modal-footer {
        flex-direction: column !important;
        gap: 8px;
        padding: 12px !important;
    }

    #composeModal .modal-footer>div {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    #composeModal .modal-footer .btn {
        width: 100% !important;
        padding: 12px !important;
    }

    /* ===== TABLES RESPONSIVE ===== */
    .table-responsive-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table.table {
        min-width: 600px;
    }

    .table-responsive {
        border: none !important;
    }

    /* ===== TOUCH TARGETS ===== */
    .btn {
        min-height: 44px;
        padding: 10px 16px !important;
    }

    .btn-sm {
        min-height: 38px;
        padding: 8px 12px !important;
    }

    .nav-link {
        padding: 12px 16px !important;
        min-height: 44px;
    }

    .email-item,
    .list-group-item {
        padding: 14px 12px !important;
    }

    /* ===== FORM ELEMENTS ===== */
    .form-control,
    .form-select {
        min-height: 44px;
        font-size: 16px !important;
    }

    .search-input {
        font-size: 16px !important;
    }

    /* ===== HEADER ADJUSTMENTS ===== */
    .email-detail-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }

    .email-detail-header .btn-group {
        width: 100%;
        justify-content: flex-end;
    }

    /* ===== CHAT SECTION ===== */
    #chat-section {
        height: calc(100vh - 120px) !important;
    }

    .chat-input-container {
        padding: 8px !important;
    }

    .chat-input-container .form-control {
        font-size: 16px !important;
    }

    /* ===== UTILITIES ===== */
    .d-mobile-none {
        display: none !important;
    }

    .d-mobile-block {
        display: block !important;
    }

    .text-truncate-mobile {
        max-width: 200px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .email-placeholder-panel {
        display: none !important;
    }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 991.98px) {
    .col-md-4.col-lg-3 {
        width: 35% !important;
        flex: 0 0 35% !important;
    }

    .col-md-8.col-lg-9 {
        width: 65% !important;
        flex: 0 0 65% !important;
    }

    .modal-lg {
        max-width: 90vw !important;
    }
}

/* ============================================= */
/* PRINT STYLES                                  */
/* ============================================= */
@media print {
    body * {
        visibility: hidden;
    }

    #email-detail-content, 
    #email-detail-content * {
        visibility: visible;
    }

    #email-detail-content {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        background: white;
        border: none;
    }

    #email-detail-content img {
        max-width: 100% !important;
        height: auto;
    }

    #email-detail-content h1, 
    #email-detail-content h2, 
    #email-detail-content h3 {
        color: black !important;
        page-break-after: avoid;
    }
    
    #email-detail-content p {
        orphans: 3;
        widows: 3;
        color: black !important;
    }

    #email-detail-content a {
        text-decoration: underline;
        color: black !important;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* ============================================= */
/* TABLE DARK HEADER WITH BRAND                 */
/* ============================================= */
.table-dark,
.table-dark th {
    background-color: var(--dark-color) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}