/* Admin Header Styles */
.spar-admin-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: -10px -20px 20px -22px;
    width: calc(100% + 22px);
    padding: 0;
    border-radius: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.spar-admin-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    pointer-events: none;
}

.spar-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 25px 40px 20px 40px;
    position: relative;
    z-index: 1;
}

/* Left side branding */
.spar-header-left {
    flex: 1;
}

.spar-plugin-branding {
    display: flex;
    align-items: center;
    gap: 20px;
}

.spar-plugin-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.spar-plugin-icon .dashicons {
    font-size: 32px;
    color: #fff;
    line-height: 1;
}

.spar-plugin-info h1.spar-plugin-name {
    margin: 0 0 5px 0;
    padding: 0;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    line-height: 1.2;
}

.spar-plugin-info h2.spar-page-title {
    margin: 0;
    font-size: 20px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    line-height: 1.3;
}

/* Right side navigation */
.spar-header-right {
    flex: 0 0 auto;
}

.spar-header-nav {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-end;
}

/* Compact stats bar */
.spar-stats-bar {
    display: flex;
    gap: 14px;
    align-items: center;
    background: rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 4px 10px;
    border-radius: 8px;
    backdrop-filter: blur(6px);
    text-align: center;
}

.spar-stats-item {
    display: grid;
    grid-template-columns: auto;
    gap: 2px;
    padding: 4px 8px;
}

.spar-stats-item:last-child {
    border-right: 0;
}

.spar-stats-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1;
}

.spar-stats-value {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
}

/* Page Navigation */
.spar-nav-pages {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.spar-nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.spar-nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.spar-nav-link.active {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.spar-nav-link .dashicons {
    line-height: 1;
}

.spar-nav-text {
    white-space: nowrap;
}

/* Action Links */
.spar-action-links {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Horizontal tools row combining stats + actions */
.spar-header-tools {
    display: flex;
    gap: 18px;
    align-items: stretch;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.spar-action-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
}

.spar-action-link:hover {
    color: #fff;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.spar-action-link .dashicons {
    line-height: 1;
}

.spar-link-upgrade {
    background: rgba(255, 193, 7, 0.2);
    border-color: rgba(255, 193, 7, 0.4);
    color: #fff;
}

.spar-link-upgrade:hover {
    background: rgba(255, 193, 7, 0.3);
    border-color: rgba(255, 193, 7, 0.6);
}

.spar-premium-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
}

.spar-premium-badge .dashicons {
    font-size: 14px;
    line-height: 1.5;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .spar-nav-text {
        display: none;
    }
    
    .spar-nav-link {
        padding: 10px;
        min-width: 40px;
        justify-content: center;
    }
    
    .spar-action-link span:not(.dashicons) {
        display: none;
    }
    
    .spar-action-link {
        padding: 8px;
        min-width: 32px;
        justify-content: center;
    }

    .spar-stats-bar {
        gap: 8px;
        padding: 6px 8px;
    }
    .spar-stats-item {
        padding: 2px 6px;
    }
    .spar-header-tools { gap: 10px; }
}

@media (max-width: 768px) {
    .spar-header-content {
        flex-direction: column;
        gap: 20px;
        align-items: center;
        text-align: center;
    }
    
    .spar-header-right {
        width: 100%;
    }
    
    .spar-header-nav {
        align-items: center;
        width: 100%;
    }
    
    .spar-nav-pages {
        justify-content: center;
        width: 100%;
    }
    
    .spar-action-links {
        justify-content: center;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .spar-header-content {
        padding: 20px 15px;
    }
    
    .spar-plugin-branding {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .spar-plugin-icon {
        width: 50px;
        height: 50px;
    }
    
    .spar-plugin-icon .dashicons {
        font-size: 28px;
    }
    
    .spar-plugin-info h1.spar-plugin-name {
        font-size: 24px;
    }
    
    .spar-nav-pages {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .spar-action-links {
        gap: 8px;
        flex-wrap: wrap;
    }
}

/* RelyWP logo in header */
.spar-relywp-logo-link {
    padding: 5px 10px;
}

.spar-relywp-logo {
    height: 24px;
    width: auto;
    display: block;
}

/* Integration with existing WordPress admin styles */
.wrap .spar-admin-header + * {
    margin-top: 0;
}

.wrap .spar-admin-header + h1 {
    display: none;
}

/* Fix for any floating elements after header */
.spar-admin-header + .clear {
    display: none;
}

/* Left menu: visual separator inside plugin submenu (non-clickable placeholder) */
#adminmenu #toplevel_page_spar-settings ul.wp-submenu a[href*="page=spar-separator-1"] {
    pointer-events: none;
    display: block;
    height: 0;
    padding: 0 !important;
    margin: 8px 0 7px 0 !important;
    border-top: 1px solid #e2e4e7;
    color: transparent !important;
    background: transparent !important;
}

#adminmenu #toplevel_page_spar-settings ul.wp-submenu a[href*="page=spar-separator-1"]:focus {
    box-shadow: none;
}