/* Inbox - Custom Styles - Light Theme */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    --light-color: #f8fafc;
    --dark-color: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --bg-light: #ffffff;
    --bg-gray: #f8fafc;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* Global Custom Scrollbar Styling */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(26, 115, 232, 0.6) rgba(0, 0, 0, 0.05);
}

/* Webkit Scrollbar (Chrome, Safari, Edge) */
*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: background 0.3s ease;
}

*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #1557b0 0%, #0f4a8a 100%);
}

*::-webkit-scrollbar-corner {
    background: rgba(0, 0, 0, 0.05);
}

/* Body and HTML Scrollbar */
html::-webkit-scrollbar,
body::-webkit-scrollbar {
    width: 12px;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #1557b0 0%, #0f4a8a 100%);
}

/* Logo Styling - Show logo if exists, fallback if not */
.logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.auth-logo {
    height: 60px;
    width: auto;
    object-fit: contain;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    /* No filter - show logo in original colors */
    filter: none !important;
}

.main-logo {
    max-width: 250px;
    width: 100%;
    height: auto;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    /* No filter - show logo in original colors */
    filter: none !important;
    /* Remove all spacing around logo */
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    vertical-align: top;
}

/* Responsive logo sizing for landing page */
@media (min-width: 992px) {
    .main-logo {
        max-width: 250px;
    }
}

@media (max-width: 991px) {
    .main-logo {
        max-width: 200px;
    }
}

@media (max-width: 768px) {
    .main-logo {
        max-width: 180px;
    }
}

@media (max-width: 576px) {
    .main-logo {
        max-width: 150px;
    }
}

.logo-fallback {
    display: none;
    align-items: center;
}

.auth-logo-placeholder {
    display: none;
    align-items: center;
    justify-content: center;
}

.logo-placeholder {
    display: none;
}

/* Ensure logos are visible by default - only hide if explicitly set to none */
img.logo-img:not([style*="display: none"]),
img.auth-logo:not([style*="display: none"]),
img.main-logo:not([style*="display: none"]),
img.sidebar-logo:not([style*="display: none"]) {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Ensure all logo images are visible and show in original colors */
img[src*="MailiasLightlogo.png"]:not([style*="display: none"]) {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    filter: none !important;
}

/* Remove all filters from logos - show in original colors */
.navbar .logo-img,
.auth-card-header .auth-logo,
.landing-hero .main-logo,
.outlook-sidebar-header .sidebar-logo {
    filter: none !important;
}

/* Body and Base Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Navbar - Light Theme */
.navbar {
    background-color: var(--bg-light) !important;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
}

.navbar-dark {
    background-color: var(--bg-light) !important;
}

.navbar-brand {
    font-weight: 600;
    color: var(--text-primary) !important;
    font-size: 1.5rem;
    letter-spacing: 0.5px;
}

.navbar-brand:hover {
    color: var(--primary-color) !important;
}

.navbar-nav .nav-link {
    color: var(--text-primary) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    transition: color 0.2s;
}

.navbar-nav .nav-link:hover {
    color: var(--primary-color) !important;
}

.navbar-toggler {
    border-color: var(--border-color);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2833, 37, 41, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Landing Page Styles */
.landing-hero {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #60a5fa 100%);
    padding: 80px 20px;
    margin: -1rem -15px 0;
    color: #ffffff;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.landing-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="100" height="100" patternUnits="userSpaceOnUse"><path d="M 100 0 L 0 0 0 100" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.landing-hero>* {
    position: relative;
    z-index: 1;
}

.main-logo {
    max-width: 250px;
    width: 100%;
    height: auto;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    filter: none !important;
    vertical-align: top;
}

.logo-placeholder {
    margin-bottom: 2rem;
}

.logo-container {
    margin-bottom: 1.5rem;
}

.logo-circle {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.logo-icon-large {
    font-size: 2.5rem;
}

.brand-name {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    letter-spacing: 2px;
    margin: 0;
}

.landing-hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.landing-hero .lead {
    font-size: 1.5rem;
    font-weight: 300;
    margin-bottom: 1.5rem;
    opacity: 0.95;
}

.landing-hero p {
    font-size: 1.1rem;
    max-width: 700px;
    margin: 0 auto 2rem;
    opacity: 0.9;
    line-height: 1.7;
}

.landing-features {
    padding: 80px 20px;
    background-color: var(--bg-light);
}

.feature-card {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2.5rem;
    height: 100%;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.feature-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: #ffffff;
    font-size: 2.5rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.feature-card h5 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
}

/* Button Styles */
.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    padding: 14px 32px;
    font-weight: 600;
    font-size: 1.1rem;
    border-radius: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
    color: #ffffff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-md);
}

/* Landing Page Button Styles - Enhanced for gradient background */
.landing-hero .btn-primary {
    background: rgba(255, 255, 255, 0.95);
    color: #1e40af;
    border: 2px solid rgba(255, 255, 255, 0.9);
    padding: 16px 40px;
    font-weight: 600;
    font-size: 1.15rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    text-transform: none;
    letter-spacing: 0.3px;
    white-space: nowrap;
    backdrop-filter: blur(10px);
}

.landing-hero .btn-primary:hover {
    background: rgba(255, 255, 255, 1);
    color: #1e3a8a;
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 1);
}

.landing-hero .btn-primary:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.landing-hero .btn-light {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.4);
    padding: 16px 40px;
    font-weight: 600;
    font-size: 1.15rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    text-transform: none;
    letter-spacing: 0.3px;
    backdrop-filter: blur(10px);
    white-space: nowrap;
}

.landing-hero .btn-light:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

.landing-hero .btn-light:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.btn-light {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 14px 32px;
    font-weight: 600;
    font-size: 1.1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-light:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Auth Pages Styles */
.auth-container {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.auth-card {
    background: var(--bg-light);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
}

.auth-card-header {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    padding: 2rem;
    text-align: center;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.auth-logo {
    height: 60px;
    width: auto;
    margin-bottom: 1rem;
    filter: none !important;
}

.auth-logo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.auth-logo-circle {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.auth-logo-icon {
    font-size: 2rem;
}

.auth-card-header h3 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem;
    color: #ffffff;
}

.auth-card-header p {
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-size: 1rem;
}

.auth-card-body {
    padding: 2.5rem;
}

/* Form Styles */
.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-control {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 1rem;
    transition: all 0.2s;
    background-color: var(--bg-light);
    color: var(--text-primary);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    background-color: var(--bg-light);
    color: var(--text-primary);
}

.form-control::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.btn {
    border-radius: 8px;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    width: 100%;
    padding: 14px;
    font-size: 1.05rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Card Styles */
.card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    background-color: var(--bg-light);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.card-body {
    padding: 2rem;
}

/* Alert Styles */
.alert {
    border-radius: 8px;
    border: none;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.alert-danger {
    background-color: #fee;
    color: #c33;
    border-left: 4px solid #dc3545;
}

.alert-success {
    background-color: #efe;
    color: #28a745;
    border-left: 4px solid #28a745;
}

/* Footer */
.footer-custom {
    background-color: var(--bg-gray);
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    margin-top: 4rem;
}

.footer-custom p {
    margin: 0;
    font-size: 0.9rem;
}

/* Links */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .landing-hero {
        padding: 60px 20px;
    }

    .landing-hero h1 {
        font-size: 2.5rem;
    }

    .landing-hero .lead {
        font-size: 1.25rem;
    }

    .landing-features {
        padding: 60px 20px;
    }

    .feature-card {
        padding: 2rem;
        margin-bottom: 1.5rem;
    }

    .auth-card-body {
        padding: 2rem;
    }

    .auth-card-header {
        padding: 1.5rem;
    }
}

@media (max-width: 576px) {
    .landing-hero h1 {
        font-size: 2rem;
    }

    .landing-hero .btn-primary,
    .landing-hero .btn-light {
        padding: 12px 28px;
        font-size: 1rem;
        width: 100%;
    }

    .brand-name {
        font-size: 2rem;
    }

    .logo-circle {
        width: 60px;
        height: 60px;
    }

    .logo-icon-large {
        font-size: 2rem;
    }
}

/* Remove dark mode support - Light theme only */
@media (prefers-color-scheme: dark) {

    /* Override any dark mode preferences - force light theme */
    body {
        background-color: var(--bg-light) !important;
        color: var(--text-primary) !important;
    }

    .card {
        background-color: var(--bg-light) !important;
        color: var(--text-primary) !important;
    }
}

/* ============================================
   MOBILE RESPONSIVE STYLES (< 576px)
   ============================================ */

/* Base Mobile Styles */
@media (max-width: 575.98px) {

    /* Typography - Ensure readability */
    body {
        font-size: 14px;
        line-height: 1.6;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    h4 {
        font-size: 1.1rem;
    }

    h5 {
        font-size: 1rem;
    }

    h6 {
        font-size: 0.9rem;
    }

    /* Spacing adjustments */
    .container,
    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Cards - Better mobile spacing */
    .card {
        margin-bottom: 1rem;
        border-radius: 8px;
    }

    .card-body {
        padding: 1rem;
    }

    .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }

    /* Buttons - Touch-friendly sizing */
    .btn {
        padding: 10px 16px;
        font-size: 14px;
        min-height: 44px;
        /* iOS touch target minimum */
        min-width: 44px;
    }

    .btn-sm {
        padding: 8px 14px;
        font-size: 13px;
        min-height: 40px;
    }

    .btn-lg {
        padding: 12px 20px;
        font-size: 16px;
        min-height: 48px;
    }

    /* Forms - Mobile optimized */
    .form-control,
    .form-select {
        padding: 10px 12px;
        font-size: 16px;
        /* Prevents zoom on iOS */
        min-height: 44px;
    }

    .form-label {
        font-size: 14px;
        font-weight: 500;
        margin-bottom: 6px;
    }

    /* Tables - Horizontal scroll on mobile */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        border: 1px solid var(--border-color);
        border-radius: 8px;
    }

    table {
        min-width: 600px;
        /* Force horizontal scroll */
    }

    .table thead th {
        font-size: 12px;
        padding: 10px 8px;
        white-space: nowrap;
    }

    .table tbody td {
        font-size: 13px;
        padding: 10px 8px;
    }

    /* Custom table classes */
    .users-table,
    table[style*="width: 100%"] {
        min-width: 600px;
    }

    /* Navbar - Mobile collapse */
    .navbar {
        padding: 0.5rem 0;
    }

    .navbar-brand {
        font-size: 1.1rem;
        padding: 0.5rem 0;
    }

    .navbar-toggler {
        padding: 0.375rem 0.5rem;
        font-size: 1.1rem;
        border: 1px solid rgba(0, 0, 0, 0.1);
    }

    .navbar-nav {
        padding-top: 1rem;
    }

    .nav-link {
        padding: 0.75rem 1rem;
        font-size: 15px;
    }

    /* Logo images - Responsive sizing */
    .logo-img,
    img[src*="MailiasLightlogo"],
    .navbar-brand img {
        max-height: 35px !important;
        width: auto !important;
        max-width: 100%;
    }

    .auth-logo {
        max-height: 50px !important;
        width: auto !important;
    }

    .main-logo {
        max-width: 180px !important;
        height: auto !important;
    }

    /* Logo fallback icons */
    .logo-fallback,
    .logo-icon {
        font-size: 1.25rem !important;
    }

    /* Modern topbar - Mobile adjustments */
    .modern-topbar {
        padding: 10px 12px;
        min-height: 56px;
    }

    .modern-topbar-left .modern-logo img {
        max-height: 32px !important;
    }

    .modern-topbar-right {
        gap: 6px;
    }

    .modern-btn {
        padding: 8px 12px;
        font-size: 13px;
        min-height: 40px;
    }

    .modern-btn span {
        display: none;
        /* Hide text on very small screens */
    }

    /* Toolbar - Stack buttons on mobile */
    .modern-toolbar {
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .modern-toolbar .modern-btn {
        flex: 1 1 auto;
        min-width: calc(50% - 3px);
    }

    /* Alerts - Better mobile spacing */
    .alert {
        padding: 12px 16px;
        font-size: 14px;
        margin-bottom: 1rem;
        border-radius: 8px;
    }

    /* Badges */
    .badge {
        font-size: 11px;
        padding: 4px 8px;
    }

    /* Dropdown menus - Full width on mobile */
    .dropdown-menu {
        width: 100%;
        max-width: 100%;
        margin-top: 0.5rem;
        border-radius: 8px;
    }

    .dropdown-item {
        padding: 12px 16px;
        font-size: 14px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Email list items - Better mobile display */
    .list-group-item {
        padding: 12px;
        font-size: 14px;
    }

    /* Sidebar - Mobile adjustments */
    /* Sidebar - Mobile adjustments - COMMENTED OUT TO PREVENT CONFLICT WITH modern-inbox.css
    .modern-sidebar {
        width: 100%;
        max-width: 280px;
    }
    */

    /* Utility classes for mobile */
    .text-mobile-center {
        text-align: center !important;
    }

    .d-mobile-none {
        display: none !important;
    }

    .d-mobile-block {
        display: block !important;
    }

    .w-mobile-100 {
        width: 100% !important;
    }

    .mb-mobile-2 {
        margin-bottom: 0.5rem !important;
    }

    .p-mobile-2 {
        padding: 0.5rem !important;
    }
}

/* Tablet and Small Desktop (576px - 991px) */
@media (min-width: 576px) and (max-width: 991.98px) {

    .container,
    .container-fluid {
        padding-left: 20px;
        padding-right: 20px;
    }

    .modern-btn span {
        display: inline;
        /* Show text on tablets */
    }

    .modern-toolbar .modern-btn {
        min-width: auto;
    }
}

/* Ensure tables are responsive */
@media (max-width: 991.98px) {

    /* Make all tables scroll horizontally */
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Admin and User management tables */
    .users-table,
    table.table,
    table[style*="width: 100%"] {
        width: 100%;
        min-width: 600px;
    }

    /* Stack table actions on mobile */
    .table td:last-child,
    .table th:last-child {
        position: sticky;
        right: 0;
        background: white;
        box-shadow: -2px 0 4px rgba(0, 0, 0, 0.1);
        z-index: 10;
    }
}

/* Logo fallback handling */
.logo-fallback {
    display: none;
    align-items: center;
    gap: 8px;
}

.logo-img[style*="display: none"]+.logo-fallback,
img[onerror]:not([src])+.logo-fallback {
    display: flex !important;
}

/* Ensure navbar collapse works */
.navbar-collapse {
    transition: all 0.3s ease;
}

/* Fix for Bootstrap 5 navbar on mobile */
@media (max-width: 991.98px) {
    .navbar-collapse.collapse:not(.show) {
        display: none;
    }

    .navbar-collapse.collapse.show {
        display: block;
    }
}

/* Email tree view and alias tables - Mobile stacking */
@media (max-width: 575.98px) {

    /* Convert table rows to cards on mobile */
    .table-responsive-mobile-stack {
        display: block;
    }

    .table-responsive-mobile-stack table,
    .table-responsive-mobile-stack thead,
    .table-responsive-mobile-stack tbody,
    .table-responsive-mobile-stack tr {
        display: block;
        width: 100%;
    }

    .table-responsive-mobile-stack thead {
        display: none;
    }

    .table-responsive-mobile-stack tr {
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 1rem;
        background: white;
        box-shadow: var(--shadow-sm);
    }

    .table-responsive-mobile-stack td {
        display: block;
        text-align: left !important;
        padding: 0.5rem 0;
        border: none;
    }

    .table-responsive-mobile-stack td:before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: var(--text-secondary);
        display: inline-block;
        min-width: 100px;
    }
}

/* Preserve light theme colors and shadows */
@media (max-width: 575.98px) {
    .card {
        box-shadow: var(--shadow-sm);
        border: 1px solid var(--border-color);
    }

    .btn-primary {
        background: var(--primary-color);
        border-color: var(--primary-color);
    }

    .btn-primary:hover {
        background: var(--primary-hover);
        border-color: var(--primary-hover);
    }

    .alert-success {
        background-color: rgba(16, 185, 129, 0.1);
        border-color: var(--success-color);
        color: #065f46;
    }

    .alert-danger {
        background-color: rgba(239, 68, 68, 0.1);
        border-color: var(--danger-color);
        color: #991b1b;
    }
}

/* Creative Glassmorphism Loading Overlay */
.gmail-page-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* frosted glass effect */
    background-color: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    animation: fadeIn 0.3s ease-out;
}

.gmail-page-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    transform: translateY(0);
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.gmail-page-loading-logo {
    height: 50px;
    width: auto;
    margin-bottom: 24px;
    animation: pulse-logo 2s infinite ease-in-out;
}

@keyframes pulse-logo {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    }

    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
    }

    100% {
        transform: scale(1);
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    }
}

.gmail-page-loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(26, 115, 232, 0.1);
    border-radius: 50%;
    border-top-color: #1a73e8;
    animation: gmail-spin 1s cubic-bezier(0.55, 0.055, 0.675, 0.19) infinite;
    position: relative;
    margin-bottom: 16px;
}

/* Multi-colored spinner animation */
@keyframes gmail-spin {
    0% {
        transform: rotate(0deg);
        border-top-color: #4285F4;
    }

    25% {
        border-top-color: #DB4437;
    }

    50% {
        transform: rotate(180deg);
        border-top-color: #F4B400;
    }

    75% {
        border-top-color: #0F9D58;
    }

    100% {
        transform: rotate(360deg);
        border-top-color: #4285F4;
    }
}

.gmail-page-loading-text {
    font-family: 'Google Sans', 'Roboto', sans-serif;
    color: #202124;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 0.3px;
    opacity: 0.8;
}

/* ============================================
   NEW ADMIN LAYOUT - SIDEBAR
   ============================================ */

:root {
    --sidebar-width: 260px;
    --header-height: 64px;
    --sidebar-bg: #ffffff;
    --sidebar-border: #e2e8f0;
    --main-bg: #f8fafc;
}

body.admin-body {
    background-color: var(--main-bg);
    display: flex;
    overflow-x: hidden;
}

/* Sidebar Styling */
.admin-sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    height: var(--header-height);
    padding: 0 24px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.sidebar-brand:hover {
    color: var(--primary-color);
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    overflow-y: auto;
}

.nav-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding-left: 12px;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
}

.nav-link i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.nav-link:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.nav-link.active {
    background: #eff6ff;
    color: var(--primary-color);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--sidebar-border);
}

.user-profile-mini {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
    cursor: pointer;
}

.user-profile-mini:hover {
    background: #f1f5f9;
}

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Main Content Area */
.admin-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 900;
}

.header-search {
    width: 300px;
    position: relative;
    display: none;
    /* Can enable later */
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.header-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.header-btn:hover {
    background: #f8fafc;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.admin-content {
    padding: 32px;
    flex: 1;
}

/* Credits Badge */
.credits-badge-pill {
    background: #dcfce7;
    color: #166534;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Mobile Toggle */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    padding: 0;
    margin-right: 16px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 991px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
    }

    .admin-main {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .admin-content {
        padding: 20px;
    }

    .admin-header {
        padding: 0 20px;
    }
}

/* Desktop - Sidebar always visible */
@media (min-width: 992px) {
    .admin-sidebar {
        transform: translateX(0) !important;
    }

    .sidebar-toggle {
        display: none !important;
    }
}

/* Common Page Styles for Redesign */
.page-header {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    color: #1a1a1a;
}

/* Sidebar Overlay - Global */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sidebar-overlay.active,
.sidebar-overlay.open {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 991px) {
    #sidebarShowBtn {
        display: flex !important;
        z-index: 1001;
    }

    .floating-mobile-toggle {
        position: fixed !important;
        left: 16px !important;
        top: 16px !important;
        z-index: 1100 !important;
        background: white !important;
        border: 1px solid #e0e0e0 !important;
        width: 40px !important;
        height: 40px !important;
        border-radius: 8px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
        align-items: center;
        justify-content: center;
    }
}