/**
 * Pro Top Layout
 * Dark topbar with inline nav links. Same SaaS tool aesthetic as pro-tool
 * but navigation sits in the topbar instead of a left sidebar.
 */

/* =============================================
   VARIABLES (shared with pro-tool palette)
   ============================================= */
:root {
    --ptp-top:    48px;
    --ptp-dark:   #0f172a;
    --ptp-border: rgba(255,255,255,0.08);
    --ptp-muted:  rgba(255,255,255,0.38);
    --ptp-hover:  rgba(255,255,255,0.06);
    --ptp-active: rgba(255,255,255,0.12);
    --ptp-white:  #ffffff;
    --ptp-bg:     #f1f5f9;
    --ptp-accent: var(--primary-color, #6366f1);
}

/* =============================================
   KILL GHOST NAV
   ============================================= */
.app-nav {
    display: none !important;
}
.mobile-header-bar {
    display: none !important;
}
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 250;
}
.mobile-overlay.active {
    display: block;
}

/* =============================================
   RESET
   ============================================= */
button, .btn, .btn-primary, a.btn, input[type=submit] {
    min-height: unset;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--ptp-bg);
}

/* Flex column so content area stretches to fill between topbar and footer */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--ptp-bg);
}

/* =============================================
   TOPBAR
   ============================================= */
.ptp-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--ptp-top);
    background: var(--ptp-dark);
    border-bottom: 1px solid var(--ptp-border);
    display: flex;
    align-items: center;
    z-index: 300;
    padding: 0 8px 0 0;
    gap: 0;
}

/* Logo */
.ptp-topbar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 0 14px;
    text-decoration: none;
    border-right: 1px solid var(--ptp-border);
    flex-shrink: 0;
    gap: 9px;
}
.ptp-topbar-logo img {
    height: 22px;
    width: auto;
    display: block;
}
.ptp-logo-initials {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: var(--ptp-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ptp-topbar-appname {
    color: rgba(255,255,255,0.80);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

/* Nav area — scrollable row of links */
.ptp-topbar-nav {
    display: flex;
    align-items: center;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    flex: 1;
    padding: 0 6px;
    gap: 2px;
}
.ptp-topbar-nav::-webkit-scrollbar { display: none; }

.ptp-topbar-nav a {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    height: 34px !important;
    padding: 0 12px !important;
    border-radius: 7px !important;
    color: var(--ptp-muted) !important;
    text-decoration: none !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    transition: background 0.12s, color 0.12s !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    min-height: unset !important;
}
.ptp-topbar-nav a i {
    font-size: 13px;
    flex-shrink: 0;
}
.ptp-topbar-nav a:hover {
    color: rgba(255,255,255,0.85) !important;
    background: var(--ptp-hover) !important;
}
.ptp-topbar-nav a.active {
    color: var(--ptp-white) !important;
    background: var(--ptp-active) !important;
    box-shadow: inset 0 -2px 0 var(--ptp-accent) !important;
}

/* Right-side actions */
.ptp-topbar-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    padding-left: 6px;
    padding-right: 8px;
    border-left: 1px solid var(--ptp-border);
    height: 100%;
    overflow: visible;
}

.ptp-topbar-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ptp-muted);
    width: 34px;
    height: 34px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: background 0.15s, color 0.15s;
    position: relative;
    flex-shrink: 0;
    min-height: unset;
    padding: 0;
    z-index: 1;
}
.ptp-topbar-btn:hover {
    background: var(--ptp-hover);
    color: rgba(255,255,255,0.85);
}

/* Notify badge */
.ptp-topbar-btn .notify-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    min-width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ef4444;
    border: 1.5px solid var(--ptp-dark);
    font-size: 0;
}
.ptp-topbar-btn .notify-badge:not(:empty) {
    min-width: 15px;
    height: 15px;
    top: 3px;
    right: 3px;
    font-size: 9px;
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2px;
}

/* Avatar button */
.ptp-topbar-avatar {
    background: none !important;
    border: none !important;
    cursor: pointer;
    padding: 0 !important;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    min-height: unset;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    flex-shrink: 0;
    opacity: 0.85;
    transition: opacity 0.15s;
}
.ptp-topbar-avatar:hover { opacity: 1; }
.ptp-topbar-avatar img,
.ptp-topbar-avatar > span {
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    font-size: 11px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

/* User dropdown */
.ptp-user-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.ptp-user-dropdown {
    display: none;
    position: fixed;
    top: calc(var(--ptp-top) + 6px);
    right: 12px;
    width: 220px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
    z-index: 9999;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}
.ptp-user-dropdown.show { display: block !important; }

/* Hamburger — mobile only */
.ptp-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ptp-muted);
    width: 34px;
    height: 34px;
    min-height: unset;
    border-radius: 7px;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    margin-left: 4px;
    flex-shrink: 0;
    padding: 0;
}

/* =============================================
   MAIN CONTENT
   ============================================= */
.ptp-main {
    margin-top: var(--ptp-top);
    flex: 1;
    background: var(--ptp-bg);
    padding: 24px;
    box-sizing: border-box;
}


/* =============================================
   FOOTER
   ============================================= */
.app-footer {
    background: var(--ptp-accent, #6366f1);
    color: rgba(255,255,255,0.85);
    padding: 12px 24px;
    font-size: 12px;
    border-top: none;
    margin-left: 0 !important;
    margin-top: 0 !important;
}
.app-footer p { margin: 0; color: rgba(255,255,255,0.85); }
.app-footer a { color: rgba(255,255,255,0.7); }

/* Override base.css mobile rules that turn the bell white — keep it dark in our topbar */
.ptp-topbar .notify-btn,
.ptp-topbar-actions .notify-btn {
    background: none !important;
    box-shadow: none !important;
    border-radius: 7px !important;
    width: 34px !important;
    height: 34px !important;
    font-size: 15px !important;
    color: var(--ptp-muted) !important;
    position: relative !important;
    top: auto !important;
    right: auto !important;
    z-index: 1 !important;
}
.ptp-topbar .notify-btn:hover,
.ptp-topbar-actions .notify-btn:hover {
    background: var(--ptp-hover) !important;
    color: rgba(255,255,255,0.85) !important;
}

/* =============================================
   AI AGENT BUTTON
   ============================================= */
#ai-agent-btn  { right: 20px !important; }
#ai-agent-panel { right: 20px !important; }

/* =============================================
   NOTIFY PANEL — reposition under topbar
   ============================================= */
@media (min-width: 768px) {
    #notifyPanel {
        position: fixed !important;
        top: calc(var(--ptp-top) + 6px) !important;
        right: 52px !important;
        left: auto !important;
        z-index: 9998 !important;
    }
}

/* =============================================
   MOBILE  (< 768px)
   ============================================= */
@media (max-width: 767px) {

    .ptp-hamburger { display: flex !important; }
    .ptp-topbar-nav { display: none; }
    .ptp-topbar-appname { display: none; }

    /* Mobile drawer slides down from topbar */
    .ptp-mobile-drawer {
        display: none;
        position: fixed;
        top: var(--ptp-top);
        left: 0;
        right: 0;
        background: var(--ptp-dark);
        border-bottom: 1px solid var(--ptp-border);
        z-index: 299;
        padding: 8px 0 12px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    }
    .ptp-mobile-drawer.open { display: block; }

    .ptp-mobile-drawer a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 20px;
        color: var(--ptp-muted);
        text-decoration: none;
        font-size: 14px;
        font-weight: 500;
        transition: background 0.12s, color 0.12s;
    }
    .ptp-mobile-drawer a:hover,
    .ptp-mobile-drawer a.active {
        background: var(--ptp-hover);
        color: var(--ptp-white);
    }
    .ptp-mobile-drawer a.active {
        color: var(--ptp-white);
        border-left: 3px solid var(--ptp-accent);
        padding-left: 17px;
    }
    .ptp-mobile-drawer a i { width: 18px; text-align: center; font-size: 14px; }

    .ptp-main {
        padding: 16px 14px;
    }
}
