/**
 * Copyright (c) 2025. IOWEB TECHNOLOGIES
 *
 * Account dropdown of the storefront header (logged-in customers).
 * Plain CSS on purpose: the theme has no build step in this checkout.
 */

/* ==================================================================
 * 1. Header utility alignment
 *
 * The desktop header renders four utility items: favourites, gift cards,
 * mini cart and (for signed-in customers) the account dropdown. The
 * theme styles each of them on its own, so the row ends up with icons of
 * different sizes, a bold mini cart label and uneven gaps.
 * The rules below give the four items one shared rhythm.
 * ================================================================== */

/*
 * The theme offsets the mini cart 10px to the left
 * (`.minicart-wrapper { right: 10px; position: absolute; }` in
 * ioweb_custom.css). That leaves a 20px gap before the cart and a 40px
 * gap after it. Resetting the offset restores three equal 30px gaps.
 */
body.io #ioMainHeaderBar .io-utilities .minicart-wrapper {
    right: auto;
}

/*
 * One icon frame for the four items.
 *
 * The header icons are outline drawings whose artwork now fills its SVG
 * canvas, so a single height renders every glyph at exactly the same
 * optical size (30px) while each keeps its natural width.
 */
body.io #ioMainHeaderBar .io-utilities .io-wishlist-icon img,
body.io #ioMainHeaderBar .io-utilities .io-giftcard-icon img,
body.io #ioMainHeaderBar .io-utilities .io-cart-icon img,
body.io #ioMainHeaderBar .io-utilities .io-my-account-icon img,
body.io #ioMainHeaderBar .io-utilities .io-account-dropdown__trigger-icon img {
    display: block;
    width: auto;
    height: 30px;
    object-fit: contain;
}

/*
 * One label typography for the four items.
 *
 * The theme bolds every link inside the mini cart wrapper
 * (`.minicart-wrapper a { font-weight: bold; }`), which makes the cart
 * label look heavier and wider than the other three.
 */
body.io #ioMainHeaderBar .io-utilities .io-wishlist-text,
body.io #ioMainHeaderBar .io-utilities .io-giftcard-text,
body.io #ioMainHeaderBar .io-utilities .io-cart-icon-text,
body.io #ioMainHeaderBar .io-utilities .io-my-account-label,
body.io #ioMainHeaderBar .io-utilities .io-account-dropdown__greeting {
    font-size: 13px;
    font-weight: 400;
    line-height: 13px;
}

body.io #ioMainHeaderBar .io-utilities .minicart-wrapper a.action.showcart {
    font-weight: 400;
}

/*
 * The account cell is a list inside the utility bar and the theme gives
 * that list a bottom margin, which lifts the account item above the
 * other three. Removing it lets the item centre like its siblings.
 */
body.io #ioMainHeaderBar .io-utilities .row.header_data > ul,
body.io #ioMainHeaderBar .io-utilities .row.header_data > ul > li {
    margin-bottom: 0;
}

/* ==================================================================
 * 2. Account dropdown
 *
 * The metrics and the colours follow the approved design
 * (Figma file "Drop-Down-Account", frame 1:2):
 *   panel       node 1:110  287 x 406, border #d3d3d3, radius 12
 *   avatar      node 1:112  61 x 61 circle
 *   initials    node 1:114  white on the black circle
 *   name        node 1:113  two lines
 *   divider     node 1:116  #d9d9d9, 240px wide
 *   rows        nodes 1:121 - 1:124, 17px labels, 24px icons
 *   blog        node 1:76   17px label
 *   sign out    node 1:136  black button, white 16px bold label
 *
 * The name of the design is 23px, the module renders it with 19px - see the rule of
 * .io-account-dropdown__name-line.
 * ================================================================== */

/* The legacy account affordance is replaced by the dropdown for signed-in customers. */
body.io li.first.my_account.io-account-logged-in > div > .io-my-account-icon,
body.io li.first.my_account.io-account-logged-in > div > .io-my-account-label {
    display: none;
}

/*
 * The dropdown is hidden when the visitor has no customer data, which happens when the
 * page was served from the cached copy of a signed-in customer. The legacy account
 * affordance is used instead (see the fallback in account-dropdown.js).
 */
body.io .io-account-dropdown--guest {
    display: none;
}

/*
 * The theme reveals the legacy header link list on hover
 * (`li.first.my_account > div:hover ul.links { display: block; }`).
 * For signed-in customers that list is replaced by the dropdown, so it stays hidden.
 */
body.io li.first.my_account.io-account-logged-in > div > ul.header.links {
    display: none;
}

body.io .io-account-dropdown {
    position: relative;
    z-index: 120;
    display: block;
}

/* Trigger: account icon above the greeting */
body.io .io-account-dropdown__trigger {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: #000;
    font: inherit;
    cursor: pointer;
}

body.io .io-account-dropdown__trigger:focus-visible {
    outline: 1px dotted currentColor;
    outline-offset: 3px;
}

body.io .io-account-dropdown__greeting {
    display: flex;
    align-items: center;
    gap: 4px;
    /* keeps the height of the greeting stable while the name is still empty */
    min-height: 13px;
    white-space: nowrap;
    color: #000;
}

/*
 * The name of the customer is delivered by the customer data section, a moment
 * after the page is rendered. While it is missing the name is hidden, so the
 * greeting does not show a lonely "Γεια σου,".
 */
body.io .io-account-dropdown__name:empty {
    display: none;
}

body.io .io-account-dropdown__name {
    font-weight: 700;
}

body.io .io-account-dropdown__caret svg {
    display: block;
    width: 12px;
    height: 12px;
}

/* Panel */
body.io .io-account-dropdown__menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 121;
    box-sizing: border-box;
    width: 287px;
    max-width: calc(100vw - 32px);
    margin-top: 16px;
    padding: 25px 0 24px;
    background: #fff;
    border: 1px solid #d3d3d3;
    border-radius: 12px;
    box-shadow: 0 4px 8px 1px rgba(0, 0, 0, .1);
    text-align: left;
    line-height: 1.4;
}

/*
 * Invisible bridge over the gap between the trigger and the panel, so the pointer
 * can travel from the trigger into the panel without the panel losing the hover.
 */
body.io .io-account-dropdown__menu::before {
    content: '';
    position: absolute;
    top: -18px;
    left: 0;
    right: 0;
    height: 18px;
}

body.io .io-account-dropdown.active > .io-account-dropdown__menu {
    display: block;
}

@media (hover: hover) and (pointer: fine) {
    body.io .io-account-dropdown:hover > .io-account-dropdown__menu {
        display: block;
    }
}

/* Profile header: black circle with the initials, the name on two lines */
body.io .io-account-dropdown__profile {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 0 16px 19px 30px;
}

body.io .io-account-dropdown__initials {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 61px;
    height: 61px;
    border-radius: 50%;
    background: #000;
    color: #fff;
    font-size: 23px;
    font-weight: 600;
    line-height: 1;
}

body.io .io-account-dropdown__identity {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

body.io .io-account-dropdown__name-line {
    display: block;
    overflow: hidden;
    color: #000;
    /*
     * The design uses 23px, but the shop renders Open Sans, which is wider than the
     * Inter of the design: a surname like "Παπαδημητρίου" needs 183px at 23px and
     * the name column of the 287px panel is 164px wide. 19px fits the long Greek
     * surnames without cutting them off.
     */
    font-size: 19px;
    font-weight: 600;
    line-height: 1.28;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/*
 * Menu rows.
 *
 * The theme underlines every header link on hover
 * (`.io #ioMainHeaderBar .io-utilities a:hover { text-decoration: underline; }`),
 * so the dropdown links need the stronger selector to stay clean.
 */
body.io #ioMainHeaderBar .io-utilities .io-account-dropdown__item a {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 24px;
    padding: 0 16px 0 29px;
    color: #000;
    text-decoration: none;
}

body.io #ioMainHeaderBar .io-utilities .io-account-dropdown__item a:hover,
body.io #ioMainHeaderBar .io-utilities .io-account-dropdown__item a:focus {
    color: #000;
    text-decoration: none;
}

/* The rows of the design are 39px apart (24px icon + 15px gap) */
body.io .io-account-dropdown__item + .io-account-dropdown__item {
    margin-top: 15px;
}

/*
 * The vertical rhythm of the design:
 * 19px below the profile divider, 22px above the divider of the blog row and
 * 16px below it.
 *
 * The theme resets every list of the header bar (`.io #ioMainHeaderBar ul`), so the
 * rules of the lists need the strong selector as well.
 */
body.io #ioMainHeaderBar .io-utilities .io-account-dropdown__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

body.io #ioMainHeaderBar .io-utilities .io-account-dropdown__list--menu {
    padding-top: 19px;
}

body.io #ioMainHeaderBar .io-utilities .io-account-dropdown__list--blog {
    padding-top: 16px;
}

body.io .io-account-dropdown__item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    color: #14ddd3;
}

body.io .io-account-dropdown__item-icon svg {
    display: block;
    width: 24px;
    height: 24px;
}

body.io .io-account-dropdown__item-label {
    flex: 0 1 auto;
    font-size: 17px;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The counter of the favourites row, e.g. "(3)" */
body.io .io-account-dropdown__item-count {
    margin-left: 4px;
    font-size: 17px;
}

body.io .io-account-dropdown__item-count:empty {
    display: none;
}

/*
 * While the number of the products in the wishlist is requested, a small loader takes
 * its place. The rule needs the class of the counter as well, because the empty
 * counter is hidden.
 */
body.io .io-account-dropdown__item-count.io-account-dropdown__item-count--loading {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 4px;
    vertical-align: middle;
    border: 2px solid #e0e0e0;
    border-top-color: #14ddd3;
    border-radius: 50%;
    animation: io-account-dropdown-spin .7s linear infinite;
}

/*
 * The request failed: the loader stops spinning and can be clicked to try again.
 */
body.io .io-account-dropdown__item-count.io-account-dropdown__item-count--failed {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 4px;
    vertical-align: middle;
    border: 2px solid #e0e0e0;
    border-top-color: #c2c2c2;
    border-radius: 50%;
    cursor: pointer;
    animation: none;
}

body.io .io-account-dropdown__item-count.io-account-dropdown__item-count--failed:hover {
    border-color: #14ddd3;
}

@keyframes io-account-dropdown-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    body.io .io-account-dropdown__item-count.io-account-dropdown__item-count--loading {
        animation: none;
    }
}

/* Divider */
body.io .io-account-dropdown__divider {
    height: 1px;
    margin: 0 21px 0 24px;
    background: #d9d9d9;
}

body.io .io-account-dropdown__divider--profile {
    margin: 0 16px 0 29px;
}

body.io .io-account-dropdown__divider--blog {
    margin-top: 22px;
}

/* Sign out */
body.io .io-account-dropdown__actions {
    padding: 16px 0 0;
}

body.io #ioMainHeaderBar .io-utilities .io-account-dropdown__signout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    box-sizing: border-box;
    width: calc(100% - 48px);
    height: 38px;
    margin: 0 24px;
    border-radius: 5px;
    background: #000;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
}

body.io #ioMainHeaderBar .io-utilities .io-account-dropdown__signout:hover,
body.io #ioMainHeaderBar .io-utilities .io-account-dropdown__signout:focus {
    background: #1c1c1c;
    color: #fff;
    text-decoration: none;
}

body.io .io-account-dropdown__signout .io-account-dropdown__item-icon {
    color: #fff;
}

body.io .io-account-dropdown__signout .io-account-dropdown__item-label {
    flex: 0 0 auto;
    font-size: 16px;
    font-weight: 700;
}

/*
 * On a narrow screen the panel keeps its 287px width, so the typography of the panel
 * is scaled down a little to keep the labels on one line.
 */
@media (max-width: 360px) {
    body.io .io-account-dropdown__name-line {
        font-size: 18px;
    }

    body.io #ioMainHeaderBar .io-utilities .io-account-dropdown__item-label {
        font-size: 16px;
    }
}
