/* layout.css - split from app.css. Load order is fixed in index.html. */
/* === SIDEBAR === */

.sidebar {
    width: 260px;
    flex: 0 0 260px;
    color: #000;
    background: linear-gradient(to bottom, #0d0d0d 0%, #111 60%, #000 100%);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease, opacity 0.3s ease;
    /* when the menu is taller than the sidebar (many items on small screens),
       scroll it so the bottom links (Settings, Contact) stay reachable */
    overflow-y: auto;
    overscroll-behavior: contain;        /* don't scroll the page behind the drawer */
    scrollbar-width: thin;               /* Firefox */
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

    /* thin, unobtrusive scrollbar to match the dark sidebar (WebKit/Blink) */
    .sidebar::-webkit-scrollbar { width: 6px; }
    .sidebar::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.15);
        border-radius: 3px;
    }

    .sidebar.closed {
        transform: translateX(-100%);
        opacity: 0;
    }

    .sidebar.open {
        transform: translateX(0);
        opacity: 1;
    }

.sidebar-toggle {
    position: absolute;
    top: 7px;
    left: 7px;
    background: rgba(13, 13, 13, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1); 
    color: #fff;
    font-size: 1.2rem; 
    cursor: pointer;
    z-index: 30;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); 
}

.sidebar-toggle:hover {
    background: rgba(17, 17, 17, 1);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7); 
}

.sidebar-toggle i {
    transition: transform 0.3s ease;
}

/* mobile dim layer; tap to close */
.sidebar-backdrop {
    display: none;
}

/* === Desktop === */
@media (min-width: 768px) {
    .sidebar-toggle {
        display: none;
    }

    .sidebar {
        transform: none !important;
        opacity: 1 !important;
        position: static;
    }
}

/* === Mobile === */
@media (max-width: 767px) {

    /* the page itself never scrolls or rubber-bands - only .content does, so the
       crust around the card can't be dragged */
    html, body {
        height: 100dvh;
        overflow: hidden;
        overscroll-behavior: none;
    }

    /* edge-to-edge full screen on phones, shrunk to ~80%. We use transform:scale,
       NOT css `zoom`: zoom is what white-boxes the Spotify embed on iOS WebKit
       (confirmed across iPhones; Android/Blink + devtools emulation render fine).
       transform keeps the embeds correct because the iframe lays out at its true
       size and the whole layer is then scaled. position:fixed + origin top-left
       fills deterministically; width/height divide by the scale so it lands at
       exactly 100vw x 100dvh. --m-scale = the single knob (lower = smaller). */
    .app-container {
        --m-scale: 0.8;
        position: fixed;
        top: 0;
        left: 0;
        width: calc(100vw / var(--m-scale));
        height: calc(100dvh / var(--m-scale));
        transform: scale(var(--m-scale));
        transform-origin: top left;
        border: none;
        border-radius: 0;
    }

    /* the desktop hover-lift transform would override the scale on touch (sticky
       :hover) and make the app look un-scaled / zoomed in - keep the scale */
    .app-container:hover {
        transform: scale(var(--m-scale));
    }

    /* drawer is bound to the app card (absolute inside .app-container), not the
       viewport - so it can't jump to the top of the screen and stays in the card */
    .sidebar {
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 20;
    }

    .content {
        width: 100%;
        position: relative;
        /* edge-to-edge now, so pad for the notch / home bar / rounded screen corners.
           insets divided by --m-zoom so the zoom doesn't shrink them below the real inset */
        padding: 20px 16px;
        padding-top: max(20px, calc(env(safe-area-inset-top) / var(--m-scale, 1)));
        padding-bottom: max(20px, calc(env(safe-area-inset-bottom) / var(--m-scale, 1)));
        padding-left: max(16px, calc(env(safe-area-inset-left) / var(--m-scale, 1)));
        padding-right: max(16px, calc(env(safe-area-inset-right) / var(--m-scale, 1)));
    }

    /* bigger tap target on mobile, pushed clear of the status bar / notch */
    .sidebar-toggle {
        width: 44px;
        height: 44px;
        top: max(7px, calc(env(safe-area-inset-top) / var(--m-scale, 1)));
    }

    /* ≥16px stops iOS zooming on focus */
    .tool-input,
    .tool-input-small {
        font-size: 16px;
    }

    .sidebar-backdrop {
        display: block;
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 15;
    }
    .sidebar-backdrop.visible {
        opacity: 1;
        pointer-events: auto;
    }

    /* full-width stacked cards on phones */
    .group-grid {
        grid-template-columns: 1fr;
    }
}

    .sidebar img.logo {
        width: 64px;
        height: 64px;
    }

/* Logo + theme selector row */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.theme-switch {
    display: flex;
    gap: 3px;
    padding: 3px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 9px;
}

.theme-opt {
    padding: 5px 9px;
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: #888;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

    .theme-opt:hover {
        color: #ccc;
    }

    .theme-opt.active {
        background: rgba(255, 255, 255, 0.12);
        color: #fff;
    }

    .sidebar h2 {
        font-size: 1.25rem;
        font-weight: 700;
        margin-bottom: 24px;
    }

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    color: #ccc;
    text-decoration: none;
    margin-bottom: 8px;
    transition: background 0.2s ease;
}

    .nav-item:hover,
    .nav-item.active {
        background: rgba(255, 255, 255, 0.1);
        color: white;
    }

    .nav-item i {
        margin-right: 10px;
    }





/* === MAIN PANEL === */

.content {
    flex: 1;
    padding: 36px;
    background: var(--content-bg, #111);
    position: relative;
    overflow-y: auto;
    overflow-x: clip;
    scrollbar-width: thin;
    scrollbar-color: #333 #222;
    display: flex; 
    flex-direction: column; 
    align-items: center;
}

    .content h1 {
        font-family: var(--app-font);
        font-size: 2.25rem;
        font-weight: bold;
        margin-bottom: 2rem;
    }

    .content h2 {
        font-size: 1.5rem;
        font-family: var(--app-font);
        font-weight: bold;
        margin-bottom: 2rem;
    }

    .content h3 {
        font-size: 1.3rem;
        font-family: var(--app-font);
        font-weight: bold;
        margin-bottom: 2rem;
     }

    .content p {
        color: #aaa;
        font-family: var(--app-font);
        font-size: 1.1rem;
    }

/* === Sidebar Footer === */
/* margin-top:auto pins it to the bottom of the flex column */
.sidebar-footer {
    margin-top: auto;
    padding: 14px 8px max(12px, env(safe-area-inset-bottom)) 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    user-select: none;
}

.sidebar-version {
    color: #777;
    font-size: 0.72rem;
    letter-spacing: 0.4px;
    font-variant-numeric: tabular-nums;
}

/* !important to beat Bootstrap's <a> reset */
.sidebar-about,
.sidebar-about:link,
.sidebar-about:visited {
    color: #bbb !important;
    font-size: 0.78rem;
    font-weight: 500;
    text-decoration: none !important;
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.sidebar-about:hover {
    color: #fff !important;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}




/* === SIDEBAR NAV DIVIDER === */
.nav-divider {
    height: 1px;
    margin: 0.6rem 0.9rem;
    /* fallback first; color-mix tints to the theme accent */
    background: rgba(255, 255, 255, 0.12);
    background: linear-gradient(90deg,
        transparent 0%,
        color-mix(in srgb, var(--accent) 45%, transparent) 50%,
        transparent 100%);
}


/* === FIRST-VISIT WELCOME TOAST === */
.welcome-toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    z-index: 60;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    width: min(440px, calc(100vw - 32px));
    box-sizing: border-box;
    padding: 14px 14px 16px 16px;
    background: var(--surface-grad);
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.55);
    /* slide up + fade in (composite-only); the -50% keeps it centred */
    animation: welcome-rise 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes welcome-rise {
    from { opacity: 0; transform: translate(-50%, 18px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

.welcome-toast-icon img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 45%, transparent));
}

.welcome-toast-body { flex: 1; min-width: 0; }

.welcome-toast-title {
    color: #fff;
    font-weight: 700;
    font-size: 0.98rem;
    margin-bottom: 2px;
}

.welcome-toast-text {
    color: #aaa;
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 10px;
}

.welcome-toast-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.15s ease;
}

    .welcome-toast-cta:hover { filter: brightness(1.1); transform: translateY(-1px); }
    .welcome-toast-cta i { transition: transform 0.15s ease; }
    .welcome-toast-cta:hover i { transform: translateX(3px); }

.welcome-toast-close {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #888;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

    .welcome-toast-close:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

@media (prefers-reduced-motion: reduce) {
    .welcome-toast { animation: none; transform: translateX(-50%); }
}


/* === SHARE === */
.sidebar-footer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.share { display: inline-flex; }

.share-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    background: var(--accent);
    border: none;
    color: #fff;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.15s ease;
}

    .share-trigger:hover { filter: brightness(1.1); transform: translateY(-2px); }

/* compact (sidebar) - small icon button */
.share-compact .share-trigger {
    padding: 4px 9px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #bbb;
    font-size: 0.85rem;
}

    .share-compact .share-trigger:hover {
        background: rgba(255, 255, 255, 0.08);
        border-color: var(--accent);
        color: #fff;
        transform: none;
    }

/* centred dialog - the desktop fallback when the native share sheet isn't available */
.share-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.share-dialog {
    width: 100%;
    max-width: 340px;
    background: var(--surface-grad);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    padding: 20px;
    animation: share-pop 0.18s ease-out;
}

@keyframes share-pop {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

.share-dialog-title {
    margin: 0 0 14px;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    text-align: center;
}

.share-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.share-opt {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--surface-border);
    color: #ddd;
    font-family: inherit;
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.14s ease, color 0.14s ease;
}

    .share-opt:hover { background: rgba(255, 255, 255, 0.09); color: #fff; }
    .share-opt i { font-size: 1rem; }

.share-x i { color: #fff; }
.share-fb i { color: #1877f2; }
.share-wa i { color: #25d366; }
.share-tg i { color: #29a9eb; }
.share-rd i { color: #ff4500; }
.share-li i { color: #0a66c2; }
.share-em i { color: var(--accent); }

.share-copy {
    grid-column: span 2;
    justify-content: center;
}


