/**
 * STRYKE WP Admin Shell
 * Topbar, sidebar, layout, CSS custom properties (dark + light modes).
 *
 * @font-face for Inter is injected via wp_add_inline_style() in
 * AdminStyles::enqueue() using an absolute URL (DSGVO-compliant local hosting).
 */

/* ==========================================================================
   CSS Custom Properties — Dark Mode (default)
   ========================================================================== */

body.stryke-shell.stryke-dark {
    --stryke-bg:             #0d0d0d;
    --stryke-sidebar-bg:     #141414;
    --stryke-topbar-bg:      #141414;
    --stryke-card-bg:        #1a1a1a;
    --stryke-card-hover:     #222222;
    --stryke-input-bg:       #1a1a1a;
    --stryke-input-border:   #333333;
    --stryke-primary:        #189ba7;
    --stryke-primary-hover:  #1db8c6;
    --stryke-primary-dark:   #147d87;
    --stryke-primary-alpha:  rgba(24, 155, 167, 0.15);
    --stryke-text:           #f0f0f0;
    --stryke-text-muted:     #888888;
    --stryke-text-heading:   #ffffff;
    --stryke-border:         #2a2a2a;
    --stryke-error:          #ff5555;
    --stryke-success:        #4CAF50;
    --stryke-warning:        #FFC107;
    --stryke-shadow:         rgba(0, 0, 0, 0.4);
    --stryke-radius-card:    8px;
    --stryke-radius-btn:     6px;
    --stryke-font:           'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --stryke-sidebar-width:  240px;
    --stryke-topbar-height:  56px;
}

/* ==========================================================================
   CSS Custom Properties — Light Mode
   ========================================================================== */

body.stryke-shell.stryke-light {
    --stryke-bg:             #f4f5f7;
    --stryke-sidebar-bg:     #ffffff;
    --stryke-topbar-bg:      #ffffff;
    --stryke-card-bg:        #ffffff;
    --stryke-card-hover:     #f8f9fa;
    --stryke-input-bg:       #ffffff;
    --stryke-input-border:   #d1d5db;
    --stryke-primary:        #147d87;
    --stryke-primary-hover:  #189ba7;
    --stryke-primary-dark:   #116a73;
    --stryke-primary-alpha:  rgba(0, 163, 181, 0.1);
    --stryke-text:           #1a1a2e;
    --stryke-text-muted:     #6b7280;
    --stryke-text-heading:   #111827;
    --stryke-border:         #e5e7eb;
    --stryke-error:          #dc2626;
    --stryke-success:        #16a34a;
    --stryke-warning:        #d97706;
    --stryke-shadow:         rgba(0, 0, 0, 0.08);
    --stryke-radius-card:    8px;
    --stryke-radius-btn:     6px;
    --stryke-font:           'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --stryke-sidebar-width:  240px;
    --stryke-topbar-height:  56px;
}

/* ==========================================================================
   Global Reset / Base
   ========================================================================== */

body.stryke-shell {
    font-family: var(--stryke-font) !important;
    background: var(--stryke-bg) !important;
    color: var(--stryke-text) !important;
    transition: background-color 0.2s ease, color 0.2s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.stryke-shell *,
body.stryke-shell *::before,
body.stryke-shell *::after {
    box-sizing: border-box;
}

/* Hide Alpine.js cloak elements until Alpine initializes */
[x-cloak] { display: none !important; }

/* ==========================================================================
   WordPress Chrome — Hide
   ========================================================================== */

body.stryke-shell #adminmenumain,
body.stryke-shell #adminmenuback,
body.stryke-shell #adminmenuwrap,
body.stryke-shell #wpadminbar,
body.stryke-shell #wpfooter {
    display: none !important;
}

body.stryke-shell #wpcontent {
    margin-left: var(--stryke-sidebar-width) !important;
    padding-left: 0 !important;
    padding-top: 0 !important;
    margin-top: var(--stryke-topbar-height) !important;
    background: #f0f0f1 !important; /* WP default admin bg — content stays light */
    color: #1d2327 !important;      /* WP default text color */
}

body.stryke-shell #wpbody {
    padding-top: 0 !important;
    background: #f0f0f1 !important;
    color: #1d2327 !important;
}

body.stryke-shell #wpbody-content {
    padding: 24px 32px;
    min-height: calc(100vh - var(--stryke-topbar-height) - 48px);
    background: #f0f0f1 !important;
    color: #1d2327 !important;
}

html.wp-toolbar {
    padding-top: 0 !important;
}

/* Hide update nags */
body.stryke-shell .update-nag {
    display: none !important;
}

/* ==========================================================================
   Top Bar
   ========================================================================== */

.stryke-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--stryke-topbar-height);
    z-index: 99999;
    background: var(--stryke-topbar-bg);
    border-bottom: 1px solid var(--stryke-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    gap: 16px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.stryke-topbar__left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.stryke-topbar__toggle {
    display: none;
    background: none;
    border: none;
    color: var(--stryke-text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
}

.stryke-topbar__toggle:hover {
    color: var(--stryke-text);
    background: var(--stryke-primary-alpha);
}

.stryke-topbar__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--stryke-text);
}

.stryke-topbar__logo:hover,
.stryke-topbar__logo:focus {
    color: var(--stryke-text);
    text-decoration: none;
}

img.stryke-logo {
    height: 28px;
    width: auto;
    display: block;
}

.stryke-logo-text {
    font-weight: 800;
    color: var(--stryke-primary);
    line-height: 1;
}

.stryke-topbar__center {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stryke-breadcrumb {
    font-size: 13px;
    color: var(--stryke-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stryke-breadcrumb a {
    color: var(--stryke-text-muted);
    text-decoration: none;
}

.stryke-breadcrumb a:hover {
    color: var(--stryke-primary);
}

.stryke-breadcrumb__sep {
    margin: 0 6px;
    opacity: 0.5;
}

.stryke-topbar__right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Top bar icon buttons */
.stryke-topbar__icon-btn,
.stryke-topbar__theme-toggle {
    background: none;
    border: none;
    color: var(--stryke-text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--stryke-radius-btn);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: color 0.15s, background 0.15s;
}

.stryke-topbar__icon-btn:hover,
.stryke-topbar__theme-toggle:hover {
    color: var(--stryke-primary);
    background: var(--stryke-primary-alpha);
}

/* Notification badge (topbar) */
.stryke-topbar__icon-btn .stryke-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--stryke-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    border-radius: 8px;
    text-align: center;
    padding: 0 4px;
}

/* User menu button */
.stryke-topbar__user {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 4px 8px 4px 4px;
    border-radius: var(--stryke-radius-btn);
    color: var(--stryke-text);
    transition: background 0.15s, border-color 0.15s;
}

.stryke-topbar__user:hover {
    background: var(--stryke-primary-alpha);
    border-color: var(--stryke-border);
}

.stryke-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.stryke-topbar__username {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

/* ==========================================================================
   Dropdowns
   ========================================================================== */

.stryke-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--stryke-card-bg);
    border: 1px solid var(--stryke-border);
    border-radius: var(--stryke-radius-card);
    box-shadow: 0 8px 24px var(--stryke-shadow);
    padding: 6px;
    z-index: 100000;
}

.stryke-dropdown__header {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--stryke-text-muted);
}

.stryke-dropdown__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    color: var(--stryke-text);
    text-decoration: none;
    font-size: 13px;
    transition: background 0.1s;
}

.stryke-dropdown__item:hover,
.stryke-dropdown__item:focus {
    background: var(--stryke-primary-alpha);
    color: var(--stryke-primary);
    text-decoration: none;
}

.stryke-dropdown__item--danger:hover,
.stryke-dropdown__item--danger:focus {
    background: rgba(255, 85, 85, 0.1);
    color: var(--stryke-error);
}

.stryke-dropdown__divider {
    height: 1px;
    background: var(--stryke-border);
    margin: 4px 0;
}

/* Position relative for dropdown parents */
.stryke-notifications,
.stryke-user-menu {
    position: relative;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

body.stryke-shell .stryke-sidebar {
    position: fixed;
    top: var(--stryke-topbar-height);
    left: 0;
    bottom: 0;
    width: var(--stryke-sidebar-width);
    z-index: 99998;
    background: var(--stryke-sidebar-bg);
    border-right: 1px solid var(--stryke-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

body.stryke-shell .stryke-sidebar::-webkit-scrollbar {
    width: 4px;
}

body.stryke-shell .stryke-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

body.stryke-shell .stryke-sidebar::-webkit-scrollbar-thumb {
    background: var(--stryke-border);
    border-radius: 2px;
}

body.stryke-shell .stryke-nav {
    list-style: none;
    margin: 0;
    padding: 12px 8px;
    flex: 1;
}

/* Nav separator */
.stryke-nav__separator {
    height: 1px;
    background: var(--stryke-border);
    margin: 8px 12px;
}

/* Nav item */
.stryke-nav__item {
    margin-bottom: 2px;
}

.stryke-nav__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--stryke-radius-btn);
    color: var(--stryke-text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border: none;
    background: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: color 0.1s, background 0.1s;
}

.stryke-nav__link:hover,
.stryke-nav__link:focus {
    color: var(--stryke-text);
    background: var(--stryke-primary-alpha);
    text-decoration: none;
    outline: none;
}

/* Active state */
.stryke-nav__item--active > .stryke-nav__link {
    color: var(--stryke-primary);
    background: var(--stryke-primary-alpha);
    font-weight: 600;
}

.stryke-nav__item--active > .stryke-nav__link .stryke-icon {
    color: var(--stryke-primary);
}

/* Label */
.stryke-nav__label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* Chevron for parent items */
.stryke-nav__chevron {
    display: flex;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.stryke-nav__chevron--open {
    transform: rotate(180deg);
}

/* Submenu */
.stryke-nav__submenu {
    list-style: none;
    margin: 0;
    padding: 2px 0 2px 44px;
}

.stryke-nav__sublink {
    display: block;
    padding: 6px 12px;
    border-radius: 4px;
    color: var(--stryke-text-muted);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.1s, background 0.1s;
}

.stryke-nav__sublink:hover,
.stryke-nav__sublink:focus {
    color: var(--stryke-text);
    background: var(--stryke-primary-alpha);
    text-decoration: none;
}

.stryke-nav__sublink--active {
    color: var(--stryke-primary);
    font-weight: 600;
}

/* Sidebar footer */
body.stryke-shell .stryke-sidebar .stryke-sidebar__footer {
    padding: 12px 20px;
    border-top: 1px solid var(--stryke-border);
    font-size: 11px;
    color: var(--stryke-text-muted);
    display: flex;
    align-items: center;
    gap: 12px;
}

body.stryke-shell .stryke-sidebar .stryke-sidebar__credit {
    color: var(--stryke-text-muted);
    text-decoration: none;
    font-size: 11px;
    transition: color 0.2s ease;
}

body.stryke-shell .stryke-sidebar .stryke-sidebar__credit:hover {
    color: var(--stryke-primary);
}

/* ==========================================================================
   Sidebar — Collapsed State
   ========================================================================== */

.stryke-sidebar--collapsed {
    width: 64px;
}

.stryke-sidebar--collapsed .stryke-nav__label,
.stryke-sidebar--collapsed .stryke-nav__chevron,
.stryke-sidebar--collapsed .stryke-nav__submenu,
.stryke-sidebar--collapsed .stryke-sidebar__footer .stryke-nav__label,
.stryke-sidebar--collapsed .stryke-sidebar__footer .stryke-sidebar__credit {
    display: none;
}

.stryke-sidebar--collapsed .stryke-nav__link {
    justify-content: center;
    padding: 10px;
}

.stryke-sidebar--collapsed + #wpcontent,
body.stryke-shell:has(.stryke-sidebar--collapsed) #wpcontent {
    margin-left: 64px !important;
}

/* ==========================================================================
   Support Page Cards (Branding module)
   ========================================================================== */

.stryke-support-page .stryke-card {
    background: var(--stryke-card-bg);
    border: 1px solid var(--stryke-border);
    border-radius: var(--stryke-radius-card);
    padding: 32px 24px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.stryke-support-page .stryke-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px var(--stryke-shadow);
    border-color: var(--stryke-primary);
}

.stryke-support-page .stryke-card__icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--stryke-primary-alpha);
    border-radius: 50%;
}

.stryke-support-page .stryke-card__icon .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
    color: var(--stryke-primary);
}

.stryke-support-page .stryke-card h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--stryke-text-heading);
    margin: 0 0 8px;
}

.stryke-support-page .stryke-card p {
    color: var(--stryke-text-muted);
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 16px;
}

.stryke-support-page .stryke-card__detail {
    color: var(--stryke-primary) !important;
    font-weight: 600;
    font-size: 13px !important;
    margin-top: 8px !important;
}

/* STRYKE Button (Branding context) */
.stryke-support-page .stryke-btn--primary {
    background: var(--stryke-primary);
    color: #fff;
}

.stryke-support-page .stryke-btn--primary:hover,
.stryke-support-page .stryke-btn--primary:focus {
    background: var(--stryke-primary-hover);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Support page misc */
.stryke-support-page .stryke-page-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--stryke-text-heading);
    margin: 0 0 8px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--stryke-primary);
}

/* ==========================================================================
   Utility — Icon sizing
   ========================================================================== */

.stryke-icon {
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
    .stryke-topbar__toggle {
        display: flex;
    }

    body.stryke-shell .stryke-sidebar {
        width: 64px;
    }

    body.stryke-shell .stryke-sidebar .stryke-nav__label,
    body.stryke-shell .stryke-sidebar .stryke-nav__chevron,
    body.stryke-shell .stryke-sidebar .stryke-nav__submenu,
    body.stryke-shell .stryke-sidebar .stryke-sidebar__footer .stryke-nav__label {
        display: none;
    }

    body.stryke-shell .stryke-sidebar .stryke-nav__link {
        justify-content: center;
        padding: 10px;
    }

    body.stryke-shell #wpcontent {
        margin-left: 64px !important;
    }

    /* Expanded sidebar overlay on mobile */
    body.stryke-shell .stryke-sidebar:not(.stryke-sidebar--collapsed) {
        width: var(--stryke-sidebar-width);
        box-shadow: 8px 0 24px var(--stryke-shadow);
    }

    body.stryke-shell .stryke-sidebar:not(.stryke-sidebar--collapsed) .stryke-nav__label,
    body.stryke-shell .stryke-sidebar:not(.stryke-sidebar--collapsed) .stryke-nav__chevron,
    body.stryke-shell .stryke-sidebar:not(.stryke-sidebar--collapsed) .stryke-sidebar__footer .stryke-nav__label {
        display: block;
    }

    body.stryke-shell .stryke-sidebar:not(.stryke-sidebar--collapsed) .stryke-nav__link {
        justify-content: flex-start;
        padding: 10px 12px;
    }
}

@media (max-width: 768px) {
    .stryke-topbar__username,
    .stryke-topbar__center {
        display: none;
    }

    body.stryke-shell #wpbody-content {
        padding: 16px;
    }

    .stryke-support-grid {
        grid-template-columns: 1fr;
    }
}
