/* =====================================================================
   MY SKIN  —  Roundcube Elastic child skin
   Reskin matching the lose.gg landing page (malik.gg / atlanta.gg vibe):
   monochrome warm-black, bitmap ProggyClean font, sharp corners,
   bordered "chips" that glow white on hover, film grain, inverted
   text selection. No accent color - everything is greyscale.

   Palette + type are lifted directly from the site's globals.css so
   this matches as closely as a dense mail client reasonably can.

   ARCHITECTURE
   -------------------------------------------------------------------
   We import Elastic's compiled CSS, keep its native dark mode forced on
   (via the myskin_theme plugin) as a sane base, then repaint everything
   to the exact lose.gg palette. The look is dark-only by design - this
   brand has no light theme, so the overrides apply unconditionally.

   Font note: ProggyClean is a BITMAP font tuned for 16px multiples, so
   at Elastic's odd sizes it can look slightly soft. If you'd rather have
   crisp text everywhere, delete the @font-face block and the font will
   fall back to Consolas/monospace (still on-brand, just not pixel).

   Load order: Elastic first (import), our overrides last + !important.
   Path to this file: skins/myskin/styles/styles.css
   Font path:         skins/myskin/fonts/ProggyClean.ttf  (../fonts/..)
   ===================================================================== */

@import url("../../elastic/styles/styles.min.css");


/* =====================================================================
   0. TOKENS  —  straight from lose.gg globals.css
   ===================================================================== */
:root {
    --bg:        #0f0e0d;   /* warm near-black page background     */
    --panel:     #121110;   /* panels / lists (a hair above bg)    */
    --rail:      #0c0b0a;   /* sidebar, slightly darker            */
    --field:     #161513;   /* input backgrounds                   */
    --ink:       #d6d6d6;   /* primary text                        */
    --dim:       #5e5e5e;   /* muted text                          */
    --chip-ink:  #a3a3a3;   /* chip / link text                    */
    --line:      #262626;   /* hairline borders                    */
    --line-hot:  #5a5a5a;   /* border on hover                     */
    --hot:       #ffffff;   /* hover / active text                 */
    --glow:      0 0 14px -2px rgba(255, 255, 255, .12); /* chip glow */

    --font: "ProggyClean", Consolas, "Courier New", monospace;
}

/* Bitmap UI font, served from the skin. */
@font-face {
    font-family: "ProggyClean";
    src: url("../fonts/ProggyClean.ttf") format("truetype");
    font-display: block;
    font-weight: normal;
    font-style: normal;
}


/* =====================================================================
   1. GLOBAL  —  font, no smoothing, sharp corners, selection
   -------------------------------------------------------------------
   IMPORTANT: we DON'T touch font-family on `*` or on `::before`, so
   Elastic's icon font keeps rendering. We set the UI font on text hosts
   and let it inherit; form controls are set explicitly (they don't
   inherit by default).
   ===================================================================== */
html, body,
input, button, select, textarea, keygen, legend, optgroup, option {
    font-family: var(--font) !important;
}

body {
    background: var(--bg) !important;
    color: var(--ink) !important;
    -webkit-font-smoothing: none;          /* crisp pixels, no AA */
    font-smooth: never;
}

/* Sharp everything - the malik.gg look has zero rounded corners. */
*, *::before, *::after { border-radius: 0 !important; }

/* Inverted selection, exactly like the site. */
::selection { background: var(--ink); color: var(--bg); }


/* =====================================================================
   2. FILM GRAIN  —  the animated noise overlay from the site
   -------------------------------------------------------------------
   Fixed, non-interactive (pointer-events:none) so it never blocks
   clicks. Kept very faint so text stays legible. Delete this whole
   block if you want a perfectly clean background.
   ===================================================================== */
body::after {
    content: "";
    position: fixed; inset: -50%;
    z-index: 2147483000;                   /* above UI, below nothing clickable */
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
    opacity: .04;
    animation: myskin-grain 1.2s steps(6) infinite;
}
@keyframes myskin-grain {
    0%   { transform: translate(0, 0); }
    20%  { transform: translate(-3%, 2%); }
    40%  { transform: translate(2%, -3%); }
    60%  { transform: translate(-2%, -1%); }
    80%  { transform: translate(3%, 3%); }
    100% { transform: translate(0, 0); }
}


/* =====================================================================
   3. SURFACES  —  repaint every Elastic surface to the mono palette
   ===================================================================== */
body,
#layout,
#layout > div,
.content,
.boxcontent,
.formcontent,
.formcontainer,
.uibox,
.listbox,
.watermark,
.iframe-wrapper,
#messagelistcontainer,
.messagelist,
table.messagelist,
.boxlistcontent,
.listing,
.contactlist,
.scroller,
.pagenav,
.footer,
fieldset,
.messageheaderlist td,
#messageheader,
.messagereadbody {
    background-color: var(--bg) !important;
    color: var(--ink) !important;
    border-color: var(--line) !important;
}

/* Sidebar / folder rail a touch darker. */
#layout-sidebar,
#layout-sidebar .scroller,
.folderlist,
#mailboxlist {
    background-color: var(--rail) !important;
    color: var(--ink) !important;
}

/* Toolbars / headers / search bars: flat, hairline bottom border. */
.toolbar,
.header,
.boxtitle,
.searchbar,
.menu,
.toolbarmenu,
.popupmenu,
.ui-dialog,
.ui-dialog-content,
.popover {
    background-color: var(--bg) !important;
    color: var(--ink) !important;
    border-color: var(--line) !important;
    box-shadow: none !important;
}

/* Muted secondary text (dates, sizes, meta). */
.messagelist .date,
.messagelist .size,
.messageheaderlist td.title,
.hint, .propform .hint,
small, .dim { color: var(--dim) !important; }


/* =====================================================================
   4. FOLDER LIST  —  sharp rows, white-glow hover, crisp selected bar
   ===================================================================== */
#mailboxlist li a,
.listing.folderlist li a {
    color: var(--chip-ink) !important;
    margin: 1px 6px !important;
    padding-left: 12px !important;
    width: auto !important;
    border: 1px solid transparent !important;
    transition: color .2s, border-color .2s, box-shadow .2s, background-color .2s !important;
}
#mailboxlist li a:hover,
.listing.folderlist li a:hover {
    color: var(--hot) !important;
    border-color: var(--line) !important;
    background-color: rgba(255, 255, 255, .03) !important;
}
#mailboxlist li.selected > a,
.listing.folderlist li.selected > a {
    color: var(--hot) !important;
    background-color: rgba(255, 255, 255, .05) !important;
    border-color: var(--line-hot) !important;
    box-shadow: inset 2px 0 0 var(--hot) !important;   /* crisp left tick */
    font-weight: normal !important;
}
#mailboxlist li.selected > a::before { color: var(--hot) !important; }

/* Unread count: outlined mono chip, not a colored badge. */
#mailboxlist li a span.unreadcount {
    background: transparent !important;
    color: var(--chip-ink) !important;
    border: 1px solid var(--line) !important;
    font-weight: normal !important;
}


/* =====================================================================
   5. TASK MENU  —  active app in white
   ===================================================================== */
#taskmenu a { color: var(--chip-ink) !important; }
#taskmenu a:hover { color: var(--hot) !important; }
#taskmenu a.active {
    color: var(--hot) !important;
    background-color: rgba(255, 255, 255, .05) !important;
    box-shadow: inset 2px 0 0 var(--hot) !important;
}


/* =====================================================================
   6. MESSAGE LIST  —  monochrome selection + hover
   ===================================================================== */
.messagelist tbody tr td { border-color: var(--line) !important; }
.messagelist tbody tr:hover td {
    background-color: rgba(255, 255, 255, .03) !important;
}
.messagelist tbody tr.selected td,
table.messagelist tr.selected td {
    background-color: rgba(255, 255, 255, .06) !important;
    color: var(--hot) !important;
}
.messagelist tr.unread td.subject {
    color: var(--hot) !important;
    font-weight: normal !important;
}
.messagelist .flagged span.flagged::before { color: var(--hot) !important; }
.messagelist td { padding-top: 7px !important; padding-bottom: 7px !important; }


/* =====================================================================
   7. TOOLBAR BUTTONS  —  clean, borderless, ink icons -> white
   ===================================================================== */
.toolbar a.button,
.toolbarmenu a {
    background: transparent !important;
    border: none !important;
    color: var(--chip-ink) !important;
    box-shadow: none !important;
    transition: color .2s, text-shadow .2s !important;
}
.toolbar a.button::before,
.toolbarmenu a::before { color: var(--chip-ink) !important; }
.toolbar a.button:hover,
.toolbar a.button:hover::before,
.toolbar a.button.selected,
.toolbar a.button.selected::before,
.toolbarmenu a:hover,
.toolbarmenu a:hover::before {
    color: var(--hot) !important;
}


/* =====================================================================
   8. ACTION BUTTONS  —  bordered "chips" that glow white on hover
   -------------------------------------------------------------------
   The site has no filled buttons; every interactive thing is an
   outlined chip. So Compose, form buttons, pagination, and the login
   button all get the chip treatment.
   ===================================================================== */
.btn,
button.btn,
.button.create,
a.button.compose,
#layout-sidebar a.compose,
.formbuttons .button,
.pagenav a.button,
input.btn-primary,
button.btn-primary {
    background: rgba(16, 16, 16, .6) !important;
    border: 1px solid var(--line) !important;
    color: var(--chip-ink) !important;
    box-shadow: none !important;
    transition: color .2s, border-color .2s, box-shadow .2s, transform .2s !important;
}
.btn:hover,
button.btn:hover,
.button.create:hover,
a.button.compose:hover,
#layout-sidebar a.compose:hover,
.formbuttons .button:hover,
.pagenav a.button:hover,
input.btn-primary:hover,
button.btn-primary:hover {
    color: var(--hot) !important;
    border-color: var(--line-hot) !important;
    box-shadow: var(--glow) !important;
    transform: translateY(-1px) !important;
}


/* =====================================================================
   9. INPUTS  —  dark sharp fields, grey -> brighter border on focus
   ===================================================================== */
input, textarea, select,
.form-control, .ui-input {
    background-color: var(--field) !important;
    color: var(--ink) !important;
    border: 1px solid var(--line) !important;
}
input:focus, textarea:focus, select:focus,
.form-control:focus {
    border-color: var(--line-hot) !important;
    box-shadow: var(--glow) !important;
    outline: none !important;
}
::placeholder { color: var(--dim) !important; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ink) !important; }


/* =====================================================================
   10. LINKS  —  grey, brighten to white on hover
   ===================================================================== */
a, a:visited { color: var(--chip-ink) !important; text-decoration: none !important; }
a:hover { color: var(--hot) !important; }


/* =====================================================================
   11. CONTACT AVATARS  —  square mono tiles (corners already killed)
   ===================================================================== */
.contactphoto,
span.contactname .initials {
    background-color: var(--field) !important;
    color: var(--ink) !important;
    border: 1px solid var(--line) !important;
}


/* =====================================================================
   12. LOGIN SCREEN  —  flat warm-black + grain + bordered chip card
   -------------------------------------------------------------------
   Mirrors the landing page: no gradient, just the mono background (the
   grain overlay from Section 2 already covers it), a sharp bordered
   card, ProggyClean title, chip-style inputs + button.
   ===================================================================== */
body:has(#login-form),
html:has(#login-form),
#layout:has(#login-form) {
    background: var(--bg) !important;
}

.login-form,
#login-form,
#login-form .box,
.box.listbox#login-form {
    background: rgba(16, 16, 16, .6) !important;
    border: 1px solid var(--line) !important;
    box-shadow: none !important;
    padding: 26px 24px !important;
    max-width: 360px !important;
    color: var(--ink) !important;
    /* a quiet rise-in, echoing the site's .center entrance */
    animation: myskin-rise .9s .1s ease-out both !important;
}
@keyframes myskin-rise {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

/* Unify each input + its icon into one sharp bordered field. */
#login-form .input-group {
    border: 1px solid var(--line) !important;
    background: var(--field) !important;
    overflow: hidden !important;
    margin-bottom: 12px !important;
    transition: border-color .2s, box-shadow .2s !important;
}
#login-form .input-group-prepend,
#login-form .input-group-text,
#login-form .input-group-append {
    background: transparent !important;
    border: none !important;
    color: var(--dim) !important;
}
#login-form .input-group .form-control,
#login-form input.form-control {
    background: transparent !important;
    border: none !important;
    color: var(--ink) !important;
    box-shadow: none !important;
}
#login-form .input-group:focus-within {
    border-color: var(--line-hot) !important;
    box-shadow: var(--glow) !important;
}

#login-form label,
#login-form td.title { color: var(--dim) !important; }

/* Login button is a chip too (inherits Section 8), just full width. */
#login-form input.btn-primary,
#login-form button.btn-primary {
    width: 100% !important;
    margin-top: 4px !important;
}

/* The logo keeps its slow float (optional, on-brand restraint). */
#login-form img, #logo {
    animation: myskin-float 5s ease-in-out infinite !important;
}
@keyframes myskin-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4px); }
}


/* =====================================================================
   13. REDUCED MOTION  —  kill the grain + float for those who ask
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
    body::after,
    #login-form, #login-form img, #logo { animation: none !important; }
}


/* =====================================================================
   14. RESPONSIVE  —  stay out of Elastic's way
   ===================================================================== */
@media screen and (max-width: 768px) {
    #mailboxlist li a { margin: 1px 4px !important; }
}
