/* =========================
   FEKII toolbar icons
   ========================= */

/* Base custom toolbar buttons */
a.toolbar-button.filter-flagged,
a.toolbar-button.filter-clear,
button.toolbar-button.filter-flagged,
button.toolbar-button.filter-clear {
    position: relative;
    display: inline-block;
    min-width: 42px;
    width: 42px;
    height: 58px;
    padding-top: 22px;
    background-position: top center;
    background-repeat: no-repeat;
    background-size: 36px;
    text-align: center;
    box-sizing: border-box;
    vertical-align: top;
}

/* Custom icons */
a.toolbar-button.filter-flagged,
button.toolbar-button.filter-flagged {
    background-image: url("/skins/fekii/images/flagged.svg");
}

a.toolbar-button.filter-clear,
button.toolbar-button.filter-clear {
    background-image: url("/skins/fekii/images/contactgroup.svg");
}

/* Hide default Roundcube icon font for these buttons */
a.toolbar-button.filter-flagged:before,
a.toolbar-button.filter-clear:before,
button.toolbar-button.filter-flagged:before,
button.toolbar-button.filter-clear:before {
    display: none !important;
    content: none !important;
}

/* Hide text visually but keep button width */
a.toolbar-button.filter-flagged .inner,
a.toolbar-button.filter-clear .inner,
button.toolbar-button.filter-flagged .inner,
button.toolbar-button.filter-clear .inner {
    display: block;
    width: 34px;
    margin: 0 auto;
    overflow: hidden;
    text-indent: -9999px;
    white-space: nowrap;
}

/* Optional hover polish */
a.toolbar-button.filter-flagged:hover,
a.toolbar-button.filter-clear:hover,
button.toolbar-button.filter-flagged:hover,
button.toolbar-button.filter-clear:hover {
    background-color: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
}

/* =========================
   FEKII widgets
   ========================= */

a.toolbar-button.widget-nextcloud,
a.toolbar-button.widget-erp {
    position: relative;
    display: inline-block;
    min-width: 42px;
    width: 42px;
    height: 58px;
    text-align: center;
    box-sizing: border-box;
}

a.toolbar-button.widget-nextcloud {
    background: url("/skins/fekii/images/nextcloud.png") no-repeat center 6px;
    background-size: 32px;
}

a.toolbar-button.widget-erp {
    background: url("/skins/fekii/images/erp506.png") no-repeat center 6px;
    background-size: 32px;
}

a.toolbar-button.widget-nextcloud:before,
a.toolbar-button.widget-erp:before {
    display: none !important;
    content: none !important;
}

a.toolbar-button.widget-nextcloud .inner,
a.toolbar-button.widget-erp .inner {
    text-indent: -9999px;
    overflow: hidden;
    display: block;
}


/* =========================
   LOGIN PAGE BACKGROUND
   ========================= */

body.task-login {
    position: relative;
    min-height: 100vh;
    background: url("/skins/fekii/images/background.jpg") center center / cover no-repeat fixed;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* dark overlay */
body.task-login::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 0;
    pointer-events: none;
}

/* Hide default layout header/menu on login if present */
body.task-login #layout > .header,
body.task-login #layout-menu {
    display: none !important;
}

/* Neutralize inherited full-height / block layout behavior on login */
body.task-login #layout,
body.task-login #layout-content {
    height: auto !important;
    min-height: auto !important;
}

/* keep login layout above overlay */
body.task-login #layout-content,
body.task-login #login-form,
body.task-login #logo,
body.task-login #login-footer {
    position: relative;
    z-index: 1;
}

/* center login card */
body.task-login #layout-content {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 28px 32px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    text-align: center;
    flex: initial !important;
    display: block !important;
}

/* logo spacing */
body.task-login #logo {
    display: inline-block;
    position: relative;
    top: auto;
    max-width: 180px;
    max-height: 100px;
    margin: 0 auto 1rem auto;
}

/* form placement */
body.task-login #login-form {
    position: relative;
    top: auto;
    width: 100%;
    max-width: 100%;
    margin: 0;
}

/* remove excess margins from roundcube defaults */
body.task-login #login-form table,
body.task-login #login-form tbody {
    width: 100%;
}

/* footer inside card */
body.task-login #login-footer {
    margin-top: 0.9rem;
    color: #5f6b76;
}

/* cleaner support link */
body.task-login #login-footer a {
    color: #1aa3e8;
    text-decoration: none;
}

body.task-login #login-footer a:hover {
    text-decoration: underline;
}


/* =========================
   FLOATING LOGIN APPS
   ========================= */

body.task-login .fekii-apps-floating {
    position: fixed;
    top: 22px;
    right: 22px;
    z-index: 5;

    display: flex;
    gap: 10px;
    align-items: center;

    padding: 10px 12px;
    border-radius: 14px;

    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.18);

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

body.task-login .fekii-apps-floating a {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 12px;
    text-decoration: none;

    background-color: rgba(255, 255, 255, 0.82);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);

    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

body.task-login .fekii-apps-floating a:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
    background-color: rgba(255, 255, 255, 0.95);
}

body.task-login .fekii-apps-floating a span.inner {
    display: none;
}

body.task-login .fekii-apps-floating a.widget-nextcloud {
    background-image: url("/skins/fekii/images/nextcloud.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 28px;
}

body.task-login .fekii-apps-floating a.widget-erp {
    background-image: url("/skins/fekii/images/erp506.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 28px;
}
body.task-login .fekii-apps-floating a.widget-live {
    background-image: url("/skins/fekii/images/live.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 28px;
}
body.task-login .fekii-apps-floating a.widget-fekii {
    background-image: url("/skins/fekii/images/fekii.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 28px;
}


body.task-login .fekii-apps-floating a.widget-nextcloud:before,
body.task-login .fekii-apps-floating a.widget-erp:before,
body.task-login .fekii-apps-floating a.widget-live:before,
body.task-login .fekii-apps-floating a.widget-fekii:before {
    display: none !important;
    content: none !important;
}


/* mobile adjustments */
@media screen and (max-width: 576px) {
    body.task-login {
        align-items: flex-start;
        padding: 84px 0 1rem 0; /* reserve space for top widget */
    }

    body.task-login #layout-content {
        max-width: calc(100% - 2rem);
        margin: 0 auto 1rem auto;
        padding: 22px 18px;
        border-radius: 12px;
    }

    body.task-login #logo {
        max-width: 150px;
        max-height: 80px;
    }

    body.task-login .fekii-apps-floating {
        top: 12px;
        right: 12px;
        left: 12px;              /* optional: keep inside screen */
        justify-content: flex-end;
        padding: 8px;
        gap: 8px;
    }

    body.task-login .fekii-apps-floating a {
        width: 44px;
        height: 44px;
        border-radius: 10px;
    }

    body.task-login .fekii-apps-floating a.widget-nextcloud,
    body.task-login .fekii-apps-floating a.widget-erp,
    body.task-login .fekii-apps-floating a.widget-live,
    body.task-login .fekii-apps-floating a.widget-fekii {
        background-size: 24px;
    }
}
