/*
 * Rainbow Rabbit dark theme override for Roundcube Elastic skin
 * Forces dark mode colors to match net.rainbowrabbit.me dark theme
 */

/* Force dark mode by overriding html element colors regardless of .dark-mode class */
:root {
    --color-dark-background: #0d1117;
    --color-dark-background-sidebar: #161b22;
    --color-dark-border: #30363d;
    --color-dark-font: #e6edf3;
    --color-font-secondary: #8b949e;
    --color-main: #58a6ff;
    --color-success: #3fb950;
    --color-warning: #d29922;
    --color-danger: #f85149;
    --color-link: #58a6ff;
}

/* Apply RR palette on top of Elastic's built-in dark mode */
html.dark-mode {
    background-color: #0d1117 !important;
}

html.dark-mode body {
    background-color: #0d1117 !important;
    color: #e6edf3 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif !important;
}

/* Main layout panels */
html.dark-mode #layout-menu,
html.dark-mode #layout-sidebar,
html.dark-mode #layout-list,
html.dark-mode #layout-content {
    background-color: #161b22 !important;
    border-color: #30363d !important;
}

/* Headers and footers in layout panels */
html.dark-mode #layout > div > .header,
html.dark-mode #layout > div > .footer {
    background-color: #161b22 !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

/* Top toolbar / toolbar buttons */
html.dark-mode .toolbar,
html.dark-mode .toolbar-inner {
    background-color: #161b22 !important;
    border-color: #30363d !important;
}

/* Input fields */
html.dark-mode input,
html.dark-mode textarea,
html.dark-mode select {
    background-color: #0d1117 !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

html.dark-mode input:focus,
html.dark-mode textarea:focus,
html.dark-mode select:focus {
    border-color: #58a6ff !important;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.12) !important;
}

/* List items */
html.dark-mode .listing tr:hover > td,
html.dark-mode .listing tr:focus > td {
    background-color: #21262d !important;
}

html.dark-mode .listing tr.selected > td,
html.dark-mode .listing li.selected {
    background-color: #1c2128 !important;
    border-color: #58a6ff !important;
}

/* Unread messages highlight */
html.dark-mode .listing tr.unread > td {
    color: #e6edf3 !important;
}

/* Links */
html.dark-mode a {
    color: #58a6ff !important;
}

html.dark-mode a:hover {
    color: #79c0ff !important;
}

/* Buttons */
html.dark-mode .button-group .button:not(.btn),
html.dark-mode button.btn {
    background-color: #21262d !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

html.dark-mode .button-group .button:hover,
html.dark-mode button.btn:hover {
    background-color: #30363d !important;
    border-color: #58a6ff !important;
    color: #58a6ff !important;
}

/* Primary action buttons */
html.dark-mode .btn-primary,
html.dark-mode a.button.primary {
    background-color: #1f6feb !important;
    border-color: #1f6feb !important;
    color: #ffffff !important;
}

html.dark-mode .btn-primary:hover,
html.dark-mode a.button.primary:hover {
    background-color: #388bfd !important;
}

/* Compose area */
html.dark-mode #composebody,
html.dark-mode .message-part.plain {
    background-color: #0d1117 !important;
    color: #e6edf3 !important;
}

/* Sidebar nav items */
html.dark-mode .navlist a,
html.dark-mode .navlist .name {
    color: #e6edf3 !important;
}

html.dark-mode .navlist a:hover {
    color: #58a6ff !important;
}

/* Login page */
html:not(.dark-mode) body {
    background-color: #0d1117 !important;
    color: #e6edf3 !important;
}

html:not(.dark-mode) #login-form,
html:not(.dark-mode) #login-logo {
    background-color: #161b22 !important;
}

html:not(.dark-mode) input,
html:not(.dark-mode) select {
    background-color: #0d1117 !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

html:not(.dark-mode) label {
    color: #8b949e !important;
}

/* Scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: #30363d #0d1117;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0d1117;
}

::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #58a6ff;
}

/* Message list unread count badge */
html.dark-mode .unread-count {
    background-color: #1f6feb !important;
    color: #ffffff !important;
}

/* Popups/modals */
html.dark-mode .popupmenu,
html.dark-mode .popover,
html.dark-mode .ui-dialog {
    background-color: #161b22 !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

html.dark-mode .popupmenu .separator,
html.dark-mode .popover .separator {
    border-color: #30363d !important;
}

/* Product name in header */
html.dark-mode #logo,
html.dark-mode .product-name {
    color: #58a6ff !important;
}
