@import "../../elastic/styles/styles.min.css";

/* ==========================================================================
   Proton Mail Theme for Roundcube Elastic Skin
   Exact Replica of Proton Mail Web Interface (Screenshot 1)
   ========================================================================== */

:root {
    --primary: #6d4aff;
    --primary-hover: #582fe0;
    --primary-light: #ece7fb;
    --color-primary: #6d4aff;
    --color-primary-hover: #582fe0;
    --color-accent: #6d4aff;
    --color-badge: #6d4aff;
}

/* Base Body & Layout */
html, body {
    height: 100vh !important;
    margin: 0 !important;
    overflow: hidden !important;
    background-color: #faf9fd !important;
    color: #1b1734 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    font-size: 14px !important;
}

body {
    display: flex !important;
    flex-direction: column !important;
}

#layout {
    flex: 1 1 auto !important;
    height: calc(100vh - 56px) !important;
    display: flex !important;
    background-color: #faf9fd !important;
    position: relative !important;
    overflow: hidden !important;
}

/* Hide Roundcube's original black vertical menu rail on desktop */
#layout-menu {
    display: none !important;
}

/* ==========================================================================
   1. Proton Top Navigation Bar
   ========================================================================== */
#proton-header {
    height: 56px !important;
    background-color: #ffffff !important;
    border-bottom: 1px solid #e9e6f2 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 16px !important;
    z-index: 100 !important;
    position: relative !important;
    user-select: none !important;
}

.proton-header-left {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    min-width: 220px !important;
}

.proton-logo-link {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    text-decoration: none !important;
}

.proton-logo-text {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #6d4aff !important;
    letter-spacing: -0.02em !important;
}

.proton-logo-sub {
    color: #3b3754 !important;
    font-weight: 600 !important;
}

/* Waffle App Switcher */
.proton-waffle-wrapper {
    position: relative !important;
}

.proton-waffle-btn {
    width: 34px !important;
    height: 34px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    border: none !important;
    background: transparent !important;
    color: #696680 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
}

.proton-waffle-btn:hover {
    background-color: #f3effc !important;
    color: #6d4aff !important;
}

.proton-waffle-dropdown {
    position: absolute !important;
    top: 44px !important;
    left: 0 !important;
    width: 320px !important;
    background: #ffffff !important;
    border: 1px solid #e5e1f2 !important;
    border-radius: 18px !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12) !important;
    padding: 16px !important;
    z-index: 999 !important;
}

.proton-waffle-dropdown.hidden {
    display: none !important;
}

.proton-waffle-heading {
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    color: #8b889e !important;
    margin-bottom: 12px !important;
    padding-left: 4px !important;
}

.proton-waffle-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
}

.proton-waffle-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px 6px !important;
    border-radius: 12px !important;
    text-decoration: none !important;
    color: #3b3754 !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    transition: background 0.15s ease !important;
}

.proton-waffle-item:hover {
    background-color: #f7f5fd !important;
    color: #6d4aff !important;
    text-decoration: none !important;
}

.proton-waffle-item.active {
    background-color: #ede8fb !important;
    color: #6d4aff !important;
}

.proton-waffle-icon {
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-bottom: 6px !important;
}

.bg-purple { background: #ede9fe; color: #6d4aff; }
.bg-indigo { background: #e0e7ff; color: #4f46e5; }
.bg-slate  { background: #f1f5f9; color: #475569; }
.bg-pink   { background: #fce7f3; color: #db2777; }
.bg-emerald{ background: #d1fae5; color: #059669; }
.bg-amber  { background: #fef3c7; color: #d97706; }
.bg-cyan   { background: #cffafe; color: #0891b2; }
.bg-rose   { background: #ffe4e6; color: #e11d48; }
.bg-blue   { background: #dbeafe; color: #2563eb; }

/* Center Search Pill */
.proton-header-center {
    flex: 1 1 auto !important;
    display: flex !important;
    justify-content: center !important;
    padding: 0 16px !important;
}

.proton-search-pill {
    width: 100% !important;
    max-width: 480px !important;
    height: 38px !important;
    background-color: #f3effc !important;
    border: 1px solid #e7e2f5 !important;
    border-radius: 9999px !important;
    display: flex !important;
    align-items: center !important;
    padding: 0 14px !important;
    gap: 10px !important;
    transition: all 0.2s ease !important;
}

.proton-search-pill:focus-within {
    background-color: #ffffff !important;
    border-color: #6d4aff !important;
    box-shadow: 0 0 0 3px rgba(109, 74, 255, 0.15) !important;
}

.proton-search-icon {
    color: #7b7891 !important;
    flex-shrink: 0 !important;
}

.proton-search-pill input {
    flex: 1 !important;
    border: none !important;
    background: transparent !important;
    outline: none !important;
    font-size: 13.5px !important;
    color: #1b1734 !important;
    padding: 0 !important;
}

.proton-search-pill input::placeholder {
    color: #7b7891 !important;
}

/* Right Header Actions */
.proton-header-right {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.proton-header-icon-btn {
    width: 34px !important;
    height: 34px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    border: none !important;
    background: transparent !important;
    color: #696680 !important;
    text-decoration: none !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
}

.proton-header-icon-btn:hover {
    background-color: #f3effc !important;
    color: #1b1734 !important;
    text-decoration: none !important;
}

.proton-header-icon-btn.proton-logout:hover {
    color: #e11d48 !important;
    background-color: #ffe4e6 !important;
}

.proton-user-info {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin: 0 4px !important;
}

.proton-user-labels {
    text-align: right !important;
    line-height: 1.15 !important;
}

.proton-user-display {
    display: block !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    color: #1b1734 !important;
}

.proton-user-mail {
    display: block !important;
    font-size: 11px !important;
    color: #78758d !important;
    font-family: monospace !important;
}

.proton-avatar-circle {
    width: 32px !important;
    height: 32px !important;
    border-radius: 9999px !important;
    background-color: #ede8fb !important;
    color: #6d4aff !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid #dcd4f7 !important;
}

/* ==========================================================================
   2. Left Sidebar & Neue Nachricht Button
   ========================================================================== */
#layout-sidebar {
    background-color: #faf9fd !important;
    border-right: 1px solid #ede9f7 !important;
    width: 240px !important;
    min-width: 220px !important;
    max-width: 280px !important;
    flex: 0 0 240px !important;
    display: flex !important;
    flex-direction: column !important;
    padding-bottom: 12px !important;
}

#layout-sidebar .header,
#layout-sidebar > .header,
.proton-hidden-tools {
    display: none !important;
}

/* Top Neue Nachricht Button */
.proton-sidebar-compose {
    padding: 14px 12px 6px 12px !important;
}

.proton-compose-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
    height: 44px !important;
    background-color: #6d4aff !important;
    color: #ffffff !important;
    border-radius: 12px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    box-shadow: 0 4px 14px rgba(109, 74, 255, 0.28) !important;
    transition: all 0.18s ease !important;
}

.proton-compose-btn:hover {
    background-color: #582fe0 !important;
    color: #ffffff !important;
    text-decoration: none !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 18px rgba(109, 74, 255, 0.36) !important;
}

/* Folder List Styling */
#mailboxlist {
    background: transparent !important;
}

ul.treelist, #mailboxlist {
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
}

ul.treelist li {
    position: relative !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 36px !important;
    overflow: visible !important;
    background: transparent !important;
    border: none !important;
}

/* Tree toggle chevron (expand / collapse caret) */
ul.treelist li div.treetoggle {
    position: absolute !important;
    top: 1px !important;
    left: 8px !important;
    width: 22px !important;
    height: 34px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 5 !important;
    cursor: pointer !important;
    color: #8b889e !important;
    background: transparent !important;
    border-radius: 6px !important;
}

ul.treelist li div.treetoggle:hover {
    color: #6d4aff !important;
}

/* Custom crisp animated chevron for treetoggle */
ul.treelist li div.treetoggle:before {
    content: "" !important;
    display: inline-block !important;
    width: 6.5px !important;
    height: 6.5px !important;
    border-right: 2px solid #8b889e !important;
    border-bottom: 2px solid #8b889e !important;
    transform: rotate(-45deg) !important;
    transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.15s ease !important;
    margin: 0 !important;
    float: none !important;
}

ul.treelist li div.treetoggle:hover:before {
    border-color: #6d4aff !important;
}

ul.treelist li div.treetoggle.expanded:before {
    transform: rotate(45deg) !important;
    margin-top: -2px !important;
}

/* Base item link */
.treelist li a, .treelist li span.mailboxname {
    color: #383350 !important;
    display: flex !important;
    align-items: center !important;
    position: relative !important;
    padding: 7px 12px !important;
    border-radius: 10px !important;
    margin: 2px 8px !important;
    font-size: 13.5px !important;
    font-weight: 500 !important;
    transition: background-color 0.15s ease !important;
    border-left: none !important;
    text-decoration: none !important;
    height: 36px !important;
    box-sizing: border-box !important;
}

/* When li has a toggle, indent text so the chevron fits neatly before the icon */
ul.treelist li:has(> div.treetoggle) > a {
    padding-left: 28px !important;
}

/* Subfolder indentation & styling */
ul.treelist li ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 2px 0 2px 20px !important;
    border-left: 1.5px solid #ede9f7 !important;
    border-top: none !important;
    border-bottom: none !important;
    border-right: none !important;
    background: transparent !important;
}

ul.treelist li ul li a {
    padding-left: 14px !important;
    margin: 1px 6px !important;
    height: 32px !important;
    font-size: 13px !important;
    color: #494560 !important;
}

ul.treelist li ul li a:hover {
    background-color: #f1edfb !important;
    color: #1b1734 !important;
}

ul.treelist li ul li.selected > a {
    background-color: #ece7fb !important;
    color: #6d4aff !important;
    font-weight: 600 !important;
}

ul.treelist li ul li ul {
    margin-left: 14px !important;
}

/* Action button on the right of parent folders */
.proton-folder-actions-btn {
    position: absolute !important;
    right: 8px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 24px !important;
    height: 24px !important;
    border: none !important;
    background: transparent !important;
    border-radius: 6px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #8b889e !important;
    cursor: pointer !important;
    opacity: 0.45 !important;
    transition: all 0.15s ease !important;
    z-index: 10 !important;
    padding: 0 !important;
}

.treelist li:hover .proton-folder-actions-btn,
.proton-folder-actions-btn:hover {
    opacity: 1 !important;
    color: #6d4aff !important;
    background-color: rgba(109, 74, 255, 0.12) !important;
}

.treelist li a:hover {
    background-color: #f1edfb !important;
    color: #1b1734 !important;
    text-decoration: none !important;
}

.treelist li.selected > a, .treelist li.selected > span, .treelist li.active > a {
    background-color: #ece7fb !important;
    color: #6d4aff !important;
    font-weight: 600 !important;
    border-left: none !important;
}

.treelist li.selected > a .count, .treelist li.active > a .count {
    background-color: #6d4aff !important;
    color: #ffffff !important;
}

.count, .unreadcount {
    background-color: #ede9f7 !important;
    color: #696680 !important;
    border-radius: 9999px !important;
    font-size: 11px !important;
    padding: 2px 7px !important;
    font-weight: 600 !important;
}

/* ==========================================================================
   3. Message List Pane ()
   ========================================================================== */
#layout-list {
    background-color: #ffffff !important;
    border-right: 1px solid #ede9f7 !important;
    display: flex !important;
    flex-direction: column !important;
}

#messagelist-header {
    background-color: #ffffff !important;
    border-bottom: 1px solid #f1eff7 !important;
    padding: 10px 16px !important;
    min-height: 48px !important;
}

#messagelist-header .header-title {
    font-size: 17px !important;
    font-weight: 700 !important;
    color: #1b1734 !important;
}

/* Proton Category Tabs Bar (Screenshot 1) */
.proton-category-tabs {
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    padding: 0 16px !important;
    background-color: #ffffff !important;
    border-bottom: 1px solid #f1eff7 !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    user-select: none !important;
}

.proton-tab {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 12.5px !important;
    font-weight: 500 !important;
    color: #696680 !important;
    padding: 10px 4px !important;
    cursor: pointer !important;
    position: relative !important;
    border-bottom: 2px solid transparent !important;
    transition: all 0.15s ease !important;
}

.proton-tab:hover {
    color: #1b1734 !important;
}

.proton-tab.active {
    color: #6d4aff !important;
    font-weight: 600 !important;
    border-bottom-color: #6d4aff !important;
}

/* Hide the embedded default search form in #layout-list since we have it in header */
#mailsearchform {
    display: none !important;
}

/* Messages Table Rows */
.messagelist {
    background-color: #ffffff !important;
}

.messagelist tbody tr {
    background-color: #ffffff !important;
    border-bottom: 1px solid #f3f1f8 !important;
    color: #2b2742 !important;
    height: 48px !important;
    transition: background-color 0.12s ease !important;
}

.messagelist tbody tr:hover {
    background-color: #f7f5fe !important;
}

.messagelist tbody tr.selected td {
    background-color: #f0ecfd !important;
    color: #1b1734 !important;
    border-left: 3px solid #6d4aff !important;
}

.messagelist tbody tr.unread td {
    font-weight: 700 !important;
    color: #110e26 !important;
}

.listing tbody tr td.subject span.fromto {
    color: #1b1734 !important;
    font-weight: 600 !important;
    font-size: 13.5px !important;
}

.listing tbody tr td.subject span.subject {
    color: #494560 !important;
    font-size: 13px !important;
}

.listing tbody tr td.subject span.date {
    color: #78758d !important;
    font-size: 12px !important;
    font-weight: 500 !important;
}

/* ==========================================================================
   4. Message Preview & Content ()
   ========================================================================== */
#layout-content {
    background-color: #ffffff !important;
}

#layout-content .header {
    background-color: #ffffff !important;
    border-bottom: 1px solid #ede9f7 !important;
    padding: 8px 16px !important;
}

/* Buttons */
.btn-primary, .button.primary, button.btn-primary {
    background-color: #6d4aff !important;
    border-color: #6d4aff !important;
    color: #ffffff !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(109, 74, 255, 0.25) !important;
    transition: all 0.15s ease !important;
}

.btn-primary:hover, .button.primary:hover {
    background-color: #582fe0 !important;
    border-color: #582fe0 !important;
    transform: translateY(-1px) !important;
}

.btn-secondary, .button {
    background-color: #f3effc !important;
    border: 1px solid #e2ddf0 !important;
    color: #3b3754 !important;
    border-radius: 8px !important;
    font-weight: 500 !important;
}

.btn-secondary:hover, .button:hover {
    background-color: #ede8fb !important;
    color: #6d4aff !important;
}

/* ==========================================================================
   5. Dark Mode Overrides (When toggled via 🌓)
   ========================================================================== */
html.dark-mode, .dark-mode body, .dark-mode #layout {
    background-color: #0d091e !important;
    color: #f1f1f4 !important;
}

.dark-mode #proton-header {
    background-color: #14102c !important;
    border-bottom-color: #2d245c !important;
}

.dark-mode .proton-logo-sub {
    color: #c4b5fd !important;
}

.dark-mode .proton-search-pill {
    background-color: #1e1840 !important;
    border-color: #2d245c !important;
}

.dark-mode .proton-search-pill input {
    color: #ffffff !important;
}

.dark-mode .proton-search-icon,
.dark-mode .proton-search-pill input::placeholder {
    color: #8a85a8 !important;
}

.dark-mode .proton-waffle-btn,
.dark-mode .proton-header-icon-btn {
    color: #a78bfa !important;
}

.dark-mode .proton-waffle-dropdown {
    background-color: #1b143f !important;
    border-color: #2d245c !important;
}

.dark-mode .proton-waffle-item {
    color: #e2e8f0 !important;
}

.dark-mode .proton-waffle-item:hover {
    background-color: #251d52 !important;
}

.dark-mode .proton-user-display {
    color: #ffffff !important;
}

.dark-mode .proton-avatar-circle {
    background-color: #2d1482 !important;
    color: #c4b5fd !important;
    border-color: #4421b8 !important;
}

.dark-mode #layout-sidebar {
    background-color: #14102c !important;
    border-right-color: #2d245c !important;
}

.dark-mode .treelist li a,
.dark-mode .treelist li span {
    color: #c4b5fd !important;
}

.dark-mode .treelist li a:hover {
    background-color: rgba(109, 74, 255, 0.15) !important;
    color: #ffffff !important;
}

.dark-mode .treelist li.selected > a {
    background-color: rgba(109, 74, 255, 0.28) !important;
    color: #ffffff !important;
}

.dark-mode #layout-list {
    background-color: #0d091e !important;
    border-right-color: #2d245c !important;
}

.dark-mode #messagelist-header,
.dark-mode .proton-category-tabs {
    background-color: #0d091e !important;
    border-bottom-color: #2d245c !important;
}

.dark-mode #messagelist-header .header-title {
    color: #ffffff !important;
}

.dark-mode .proton-tab {
    color: #8b889e !important;
}

.dark-mode .proton-tab:hover {
    color: #ffffff !important;
}

.dark-mode .messagelist tbody tr {
    background-color: #0d091e !important;
    border-bottom-color: #1f1842 !important;
    color: #e2e8f0 !important;
}

.dark-mode .messagelist tbody tr:hover {
    background-color: rgba(109, 74, 255, 0.12) !important;
}

.dark-mode .messagelist tbody tr.selected td {
    background-color: rgba(109, 74, 255, 0.25) !important;
    color: #ffffff !important;
}

.dark-mode .messagelist tbody tr.unread td {
    color: #ffffff !important;
}

.dark-mode .listing tbody tr td.subject span.fromto {
    color: #ffffff !important;
}

.dark-mode .listing tbody tr td.subject span.subject {
    color: #a78bfa !important;
}

.dark-mode #layout-content {
    background-color: #14102c !important;
}

.dark-mode #layout-content .header {
    background-color: #14102c !important;
    border-bottom-color: #2d245c !important;
}


/* ==========================================================================
   Popover & Folder Actions Styling (Proton Mail Card)
   ========================================================================== */
.popover {
    background-color: #ffffff !important;
    border: 1px solid #e5e1f2 !important;
    border-radius: 14px !important;
    box-shadow: 0 12px 36px rgba(109, 74, 255, 0.14), 0 4px 12px rgba(0, 0, 0, 0.08) !important;
    padding: 6px !important;
}

.popover-body {
    padding: 0 !important;
}

.popover .menu.listing {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.popover .menu.listing li {
    background: transparent !important;
    border: none !important;
    height: auto !important;
    margin: 2px 0 !important;
}

.popover .menu.listing li a {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #3b3754 !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    transition: all 0.12s ease !important;
    border: none !important;
}

.popover .menu.listing li a:hover {
    background-color: #f3effc !important;
    color: #6d4aff !important;
}

.popover .menu.listing li a.disabled {
    color: #a09cb4 !important;
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

/* Dark mode additions */
.dark-mode #layout-sidebar > .header,
.dark-mode .proton-hidden-tools {
    display: none !important;
}

.dark-mode ul.treelist li div.treetoggle:before {
    border-color: #8a85a8 !important;
}

.dark-mode ul.treelist li div.treetoggle:hover:before {
    border-color: #c4b5fd !important;
}

.dark-mode ul.treelist li ul {
    border-left-color: #2d245c !important;
}

.dark-mode .proton-folder-actions-btn {
    color: #8a85a8 !important;
}

.dark-mode .proton-folder-actions-btn:hover {
    color: #c4b5fd !important;
    background-color: rgba(109, 74, 255, 0.25) !important;
}

.dark-mode .popover {
    background-color: #1b143f !important;
    border-color: #2d245c !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4) !important;
}

.dark-mode .popover .menu.listing li a {
    color: #e2e8f0 !important;
}

.dark-mode .popover .menu.listing li a:hover {
    background-color: #251d52 !important;
    color: #ffffff !important;
}
